#include<iostream>
#include<string>
using namespace std;
int main()
{
string match;
string word;
string s[1000000];
int len = 0;
int count = 0;
int minindex = -1;
cin>>match;
for(int i = 0; i < match.size(); i++)
{
match[i] = toupper(match[i]);
}
while(cin>>word)
{
for(int i = 0; i < word.size(); i++)
{
word[i] = toupper(word[i]);
}
s[len] = word;
++len;
}
for(int i = 0; i < len; i++)
{
if(match == s[i])
{
count++;
if(minindex == -1)
{
minindex = i;
}
}
}
if(count == 0)
{
cout<<"-1"<<endl;
}
else
{
cout<<count<<" "<<minindex<<endl;
}
return 0;
}