#include <iostream>
#include <cstring>
using namespace std;
string s2, s1;
int main (){
int n = 0, count = 0, i = 0, pos = -1;
bool is;
getline(cin, s1, '\n');
getline(cin, s2);
// while(s1[i] != '0'){
// n++; //a【】数组元素数量
// i++;
// }
i = 0;
while(i < s2.length()){ // //to too?
if((s2[i] == s1[0]-32 || s2[i] == s1[0] + 32 )|| s2[i] == s1[0]){
if(i>0){
if(s2[i-1]!=' '){ //是否是第一个1字母
i++;
continue;
}
}
int z = i+1;
for(int j = 1; j < s1.length(); j++){ //
if(s2[z] == s1[j] || s2[z] == s1[j] -32 || s2[z] == s1[j] +32) //
// if((s2[z+1] <='z'&&s2[z+1]>='a')||(s2[z+1]<='Z'&&s2[z+1]>='A'))
// is = false;
// else
is = true;
else{
is = false;
break;
}
z++;
}
if((s2[z]<='z'&&s2[z]>='a')||(s2[z]<='Z'&&s2[z]>='A'))//是否是最后一个字符
is = false;
if(is == true)
{
count++;
if(pos == -1)
pos = i;
}
}
i++;
}
if(count == 0)
cout << -1;
else
cout << count << " " << pos;
}