s = input().lower() word = input().lower().split() #print(word) if s not in word: print(-1) else: print(word.count(s), word.index(s))