#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
string a,b;
string tmp;
size_t pos = 0;
int cnt = 0;
getline(cin,a);
getline(cin,b);
transform(a.begin(),a.end(),a.begin(),::tolower);
transform(b.begin(),b.end(),b.begin(),::tolower);
stringstream ssin(b);
while (ssin>>tmp)
{
if(tmp==a) cnt++;
}
if(cnt) {
pos = b.find(a);
cout<<cnt<<' '<<pos;
}
else cout<<-1;
return 0;
}