#include<iostream>
#include<cstring>
using namespace std;
int main()
{
int count=0,first;
string a,b;
getline(cin,a);
getline(cin,b);
for(int i=0;i<b.size();i++)
{
if(isupper(b[i])||isupper(a[i]))
{
b[i]=tolower(b[i]);
a[i]=tolower(a[i]);
}
}
bool flag=true;
for(int i=0;i<b.size();i++)
{
int j=i;
int k=0;
while(b[j]!=' '&&j<b.size())
{
if(a[k]==b[j])
{
k++;
}
else
break;
if(k==a.size()&&(b[j+1]==' '||j==b.size()-1))
{
count++;
}
j++;
}
i=j;
if(count==1&&flag)
{
first=j-a.size();
flag=false;
}
}
if(count>=1)
cout<<count<<" "<<first;
else
cout<<-1;
return 0;
}