#include<cstdio>
#include<cstring>
using namespace std;
char find[10+1],word[10+1];
char*big_to_small(char*str){
for(int i=0;i<strlen(str);i++)
if('A'<=str[i]&&str[i]<='Z')str[i]=str[i]-'A'+'a';
return str;
}
int main(){
int cnt=0,pos=-1,l=0;
scanf("%s",&find);
big_to_small(find);
while(scanf("%s",&word)!=EOF){
big_to_small(word);
if(strcmp(find,word)==0){
cnt++;
if(pos==-1)pos=l;
}
l+=strlen(word)+1;
}
if(cnt==0)printf("-1");
else printf("%d %d",cnt,pos);
return 0;
}