#include<bits/stdc++.h>
using namespace std;
int main(){
int ans=-1,cnt=0,k=0;
string s,t;
cin>>t;
for(int j=0;j<t.size();j++)
t[j]=tolower(t[j]);
while(cin>>s){
for(int j=0;j<s.size();j++)
s[j]=tolower(s[j]);
if(s==t){
if(ans==-1) ans=k;
cnt++;
}
k+=s.size()+1;
}
if(ans==-1){
cout<<ans;
return 0;
}
else cout<<cnt<<" "<<ans;
return 0;
}