#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
int main(){
string s1,s2; getline(cin, s1); getline(cin,s2);
transform(s1.begin(), s1.end(), s1.begin(), ::tolower);
transform(s2.begin(), s2.end(), s2.begin(), ::tolower);
vector <string> words;
vector <int> index;
string word;
stringstream ss(s2);
while(ss >> word){
words.push_back(word);
}
int cnt = 0;
for(int i = 0; i < words.size(); ++i){
if(s1 == words[i]){
cnt++;
index.push_back(i);
}
}
if(cnt == 0) cout << -1;
else cout << cnt << " " << index[0];
return 0;
}