#include <bits/stdc++.h>
using namespace std;
string Find;
string word[1000001];
int cnt;
int ans,first;
bool flag;
int main() {
cin >> Find;
transform(Find.begin(),Find.end(),Find.begin(),::tolower);
cnt=0;
while(cin >> word[cnt]) {
transform(word[cnt].begin(),word[cnt].end(),word[cnt].begin(),::tolower);
if (word[cnt]==Find) {
ans++;
first=min(first,cnt);
}
cnt++;
}
if (ans!=0)
cout << ans << " " << first;
else cout << -1;
return 0;
}