n = input() s = list(map(str,input().split())) n = n.upper() c = 0 d = 0 g = '' for i in s: if i.upper() == n: c += 1 d = 1 if d == 0: g = g+i g = g+'0' if c>0: print(c,end = ' ') print(len(g)) else: print(-1)