#include<bits/stdc++.h>
using namespace std;
string s;
string art;
bool vis=1,t=1;
int num=0;
int location=0;
int main(){
getline(cin, s);
getline(cin,art);
int len1=s.length();
int len2=art.length();
int l=0;
for(int i = 0 ; i <= len2;){
if(vis){
if(s[l]==art[i]||s[l]==art[i]+32||s[l]==art[i]-32){
l++;
i++;
if(l==len1){
if(art[i]==' ' || i==len2){
num++;
}
l=0;
if(t){
location=i-len1;
t=false;
}
}
}
else{
vis=false;
l=0;
}
}
else{
if(art[i]==' ')
vis=1;
i++;
}
}
if(num){
cout<<num<<' '<<location<<endl;
}
else
cout<<-1<<endl;
return 0;
}