#include<bits/stdc++.h>
using namespace std;
int main()
{
int ans=0,p;
int i,j,k;
bool once=0;
char word[20],sentence[10000010],cpword[50];
cin.getline(word,20);
cin.getline(sentence,10000010);
for(i=0;i<strlen(word);i++)
if(word[i]<'a')
word[i]+=32;
for(i=0;i<strlen(sentence);i++)
if(sentence[i]<'a'&&sentence[i]!=' ')
sentence[i]+=32;
for(i=0;i<strlen(sentence);i++)
{
if(sentence[i]!=' ')
{
for(j=i,k=0;sentence[j]!=' '&&j<strlen(sentence);j++,k++)
cpword[k]=sentence[j];
if(strlen(word)==strlen(cpword))
{
for(k=0;k<strlen(word);k++)
if(word[k]!=cpword[k])
break;
if(k==strlen(word))
{
ans++;
if(once==0)
p=i;
once=1;
}
}
memset(cpword,0,50);
i=j;
}
}
if(ans==0)
cout<<-1;
else
cout<<ans<<" "<<p;
return 0;
}