#include <bits/stdc++.h>
std::string s, x;
int main()
{
std::ios::sync_with_stdio(false);
std::cin >> s;
std::transform(s.begin(), s.end(), s.begin(), tolower);
int first = -1, cnt = 0, len = 0;
bool have = 0;
while (std::cin >> x)
{
std::transform(x.begin(), x.end(), x.begin(), tolower);
if (x == s)
{
if (have == 0)
have = 1, first = len;
cnt++;
}
len += x.size() + 1;
}
if (first == -1)
printf("-1");
else
printf("%d %d", cnt, first);
return 0;
}