#include<bits/stdc++.h>
using namespace std;
int compare(string a,string b){
if(a==b) return 1;
else return 0;
}
int main() {
string s1,s2,s;
int count=0,c2=0,c3=0,flag=1;
getline(cin,s1);
if(s1[0]>='A'&&s1[0]<='Z') s1[0]=s1[0]-'A'+'a';
getline(cin,s2);
for(int i=0;i<s2.size();i++){
c2=i;
while(s2[i]!=' '&&s2[i]!='\0'){
s+=s2[i++];
}
if(s[0]>='A'&&s[0]<='Z') s[0]=s[0]-'A'+'a';
if(compare(s1,s)&&flag) {
flag=0;
c3=c2;
}
count+=compare(s1,s);
s.clear();
}
if(count)
cout<<count<<' '<<c3;
else cout<<-1;
}