#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
string a,b;
int main()
{
int tem=1,s=0,site=0;
getline(cin,a);
getline(cin,b);
for (int i=0;i<max(a.length(),b.length());i++)
{
a[i]=tolower(a[i]);
b[i]=tolower(b[i]);
}
a=' '+a;
b=' '+b;
for(int i=0;b[i]!='\0';i++)
{
if(b[i]==' ')
{
tem=1;
for(int j=i+1,k=1;k<a.length();j++,k++)
{
if(a[k]!=b[j])
{
tem=0;
break;
}
}
if (tem==1)
{
s++;
}
if(s==1 && tem==1)
{
site=i;
tem=0;
}
}
}
if (s==0)
{
cout<<-1;
}
else if (s>= 1)
{
printf("%d %d",s,site);
}
}