#include<iostream>
#include<bits/stdc++.h>//万能头文件
/*#include<cstdio>
#include<cmath>
#include<algorithm>//sort函数库
#include<cstring>
#include<stdlib.h>
#include<ctime>*/
#define gets(S) fgets(S,sizeof(S),stdin)
using namespace std;
string compare;
string word;
int main()
{
cin >> compare;
int key = 0,first=999;
for (int i = 0; i < compare.size(); i++)
{
if (compare[i] >= 'A' && compare[i] <= 'Z')
{
compare[i] += 32;
}
}
long long s = 0;
while (cin >> word)
{
for (int i = 0; i < word.size(); i++)
{
if (word[i] >= 'A' && word[i] <= 'Z')
{
word[i] += 32;
}
}
if (word == compare)
{
s++;
if (first > key)
{
first = key;
}
}
key++;
}
if (s == 0)
{
cout << "-1";
}
else
{
cout << s << " " << first << endl;
}
return 0;
}