#include<bits/stdc++.h>
using namespace std;
char s[100010],w[100];
int x=0,y=-1;
int main()
{
scanf("%s",w);
getchar();
cin.getline(s,100010);
for(int i=0;i<strlen(w);i++)
if(w[i]>='A' && w[i]<='Z')
w[i]+=32;
for(int i=0;i<strlen(s);i++)
if(s[i]>='A' && s[i]<='Z')
s[i]+=32;
for(int i=0;i<strlen(s);i++)
{
if(s[i]==' ')
continue;
int j=i+1;
while(s[j]!=' ' && j<strlen(s))
j++;
bool c=true;
for(int k=0;k<strlen(w);k++)
if(w[k]!=s[i+k])
c=false;
if(c)
{
x++;
if(y==-1)
y=i;
}
i=j;
}
if(y==-1)
printf("%d",y);
else
printf("%d %d",x,y);
return 0;
}