#include<iostream>
#include<string>
#include<cctype>
#include <sstream>
using namespace std;
int main()
{
string article1;
string article2;
string word1;
string word2;
getline(cin, word1);
getline(cin, article1);
for (char c : article1)
{
if (isalpha(c))
{
article2 += tolower(c);
}
if (c == ' ')
{
article2 += ' ';
}
}
for (char c : word1)
{
if (isalpha(c))
{
word2 += tolower(c);
}
}
istringstream iss(article2);
int counter = 0;
int site=0;
int firstsite;
bool ifsite = false;
string word;
while (iss>>word)
{
if (word == word2)
{
counter++;
if (ifsite == false)
{
ifsite = true;
firstsite=site;
}
}
else
{
site+= word.length() + 1;
}
}
if (ifsite == false)
{
cout << "-1";
}
else
{
cout <<counter<<" "<< firstsite;;
}
}