#include<bits/stdc++.h>
using namespace std;
string a,s,b;
int cnt,first,was;
int main(){
getline(cin,a);
transform(a.begin(),a.end(),a.begin(),::tolower);
getline(cin,s);
transform(s.begin(),s.end(),s.begin(),::tolower);
s+=' ';
for(int i=0;i<s.size();i++){
if(s[i]==' '){
b=s.substr(was,i-was);
if(b==a){
cnt++;
}
was=i+1;
}
}
first=s.find(a,0);
if(cnt!=0&&first!=-1)cout<<cnt<<' '<<first;
else cout<<-1;
return 0;
}