f = input().strip().lower() s = input().lower() cot = s.split().count(f) lf = len(f) for i in range(len(s)): if s[i] == f[0]: if s[i:i+lf] == f and s[i+lf]==' ' and s[i-1]==' ' or i-1 == 1: print(cot, i) break else: print(-1)