#include<iostream>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<string>
#include<deque>
using namespace std;
int main(){
string a,b;
cin>>a;
int cnt=0,firstpow=-1,cntp=0;
while (cin>>b){
if (b.length()==a.length()){
bool is_have=false;
for (int i=0;i<a.length();i++){
if (abs(b[i]-a[i])!=abs('A'-'a') && b[i]!=a[i]){
is_have=true;
break;
}
}
if (!is_have){
if (firstpow==-1){
firstpow=cntp;
}
cnt++;
}
}
cntp++;
}
if (firstpow==-1){
cout<<-1;
return 0;
}
cout<<cnt<<" "<<firstpow;
return 0;
}