s=input() t=input().split() x=0 arr=[] for i in range(len(t)): if s.lower() == t[i].lower(): x+=1 arr.append(i) if x !=0: print("{} {}".format(x,arr[0])) else: print(-1)