#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
string toL(string s) {
transform(s.begin(), s.end(), s.begin(), ::tolower);
return s;
}
int main() {
string s; cin >> s;
s = toL(s);
string s1;
cin.get();
getline(cin, s1);
s1 = toL(s1);
int ans = -1;
string split = " ";
s1 += split;
int pos = s1.find(split);
int step = split.size();
int first = 0;
int x = first;
int flag = 0;
while (pos != s1.npos) {
string temp = s1.substr(0, pos);
if (s == temp) {
if (flag == 0) {
x = first;
flag = 1;
}
ans++;
}
else first += temp.size()+1;
s1 = s1.substr(pos + step);
pos = s1.find(split);
}
if (ans != -1) {
ans++;
cout << ans << " " << x;
}
else {
cout << ans ;
}
return 0;
}