#include<iostream>
#include<cstring>
#include<string>
#include<cstdio>
#include<queue>
#include<cmath>
#include<algorithm>
using namespace std;
string a;
int n=0,one,ans=0;
bool gg=true;
string b;
int main(){
cin >>a;
while(cin>>b){
bool f=true;
for(int i=0;i<b.length();i++){
if(b[i]!=a[i]&&b[i]!=a[i]+('a'-'A')&&b[i]!=a[i]-('a'-'A')){
f=false;
break;
}
}
if(f){
ans++;
if(gg){
one=n;
gg=false;
}
}
n++;
}
if(ans==0){
cout <<-1;
}else{
cout <<ans<<" "<<one;
}
return 0;
}