#include <bits/stdc++.h>
#include <vector>
#include <limits>
#include <cctype>
using namespace std;
void lo(std::string& str);
int main()
{
string a,b;
getline(cin,a);
string text;
getline( cin,text );
int i,j;
int c=0;
lo(a);
lo(text);
text.insert(text.end(),' ');
for(i = 0 ; i < text.size() ; i++){
while(i < text.size() && text[i] == ' '){
i++;
}
j = i;
b.clear();
while(j < text.size() && text[j] != ' '){
b += text[j];
j++;
}
i = j - 1;
if(a == b){
c++;
}
}
if(c!=0){
cout<<c<<" "<<text.find(a);
}
else{
cout<<-1;
}
return 0;
}
void lo(std::string &str) {
for (size_t i = 0; i < str.length(); ++i) {
if (isupper(str[i])) {
str[i] = tolower(str[i]);
}
}
}