#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
// ios::sync_with_stdio(false);
// cin.tie(NULL);
// cout.tie(NULL);
string s;
cin >> s;
s= ' '+s+' ';
transform(s.begin(),s.end(),s.begin(),::tolower);
string x = "";
while(1)
{
char a;
a = getchar();
if(a ==EOF) break;
if(a == '\n') continue;
if(a == ' ') x = x+' ';
else x+=tolower(a);
}
x = ' ' + x + ' ';
//cout << x;
int t = 0,ans = -1,ff = 0;
int f = 0;
while(1)
{
f = x.find(s,f + 1);
if(f == -1) break;
if(ff) {t ++;
//x.erase(0,f + s.size()-1);
}
else {
// x.erase(0,f + s.size()-1);
ans = f;
t++;
ff= 1;
}
}
if(ans == -1) cout << ans;
else cout << t << " " << ans;
return 0;
}