#include <iostream>
#include <string>
#include <vector>
#define MAX 1000000
using namespace std;
string xiaoxie(string s){
int n = s.length();
for(int i=0;i<n;i++){
s[i]=tolower(s[i]);
}
return s;
}
int main(){
string s;
string str[MAX];
string temp;
cin>>s;
s= xiaoxie(s);
int num=0;
int count=0;
while(cin>>temp){
temp = xiaoxie(temp);
str[num] = temp;
num++;
}
int index=0;
for(int i=0;i<num;i++){
if(s==str[i]){
count++;
if(count == 1){
index =i;
}
}
}
if(count ==0){
cout<<-1;
}
else{
cout<<count<<" "<<index<<endl;
}
}