a=input() s=input().split() """b=list(a) del(b[-1]) a=''.join(b)""" a=a.upper() k=0 for i in range(len(s)): s[i]=s[i].upper() for i in range(len(s)): if a==s[i]: t=i break k=s.count(a) if a in s: print("%d %d"%(k,t)) else: print(-1)