#include<bits/stdc++.h>
using namespace std;
int main()
{
int count =0,firstpostion=0;
string s,s1;
cin >> s;
for(int i = 0 ; i< s.length() ;i++){
if(s[i] >= 'A' && s[i] <= 'Z'){
s[i] += 32;
}
}
int sum = 0;
bool flag = false;
while(cin >> s1){
for(int i = 0 ; i< s1.length() ;i++){
if(s1[i]>='A' && s1[i] <='Z'){
s1[i] +=32;
}
}
if(s1 == s){
count++;
if(!flag){
firstpostion = sum;
flag = true;
}
}
sum += s1.length()+1;
}
if(count!=0){
cout << count << " " << firstpostion;
}else{
cout << -1;
}
}