#include<bits/stdc++.h>
using namespace std;
void chu(string a,string b){
int i,j,k,count=0,count0;
for(i=0;b[i]!=NULL;i++){
k=i;
for(j=0;a[j]!=NULL;j++){
if((a[j]==b[k]||a[j]+32==b[k])||a[j]-32==b[k]){
k++;
}
if(a[j]==NULL){
count++;
if(count==1)
count0=k-j;
}
}
}
if(count!=0)
cout<<count<<" "<<count0;
else
cout<<-1;
}
int main()
{
int i,count,count0;
string a,b;
getline(cin,a);
getline(cin,b);
chu(a,b);
}