#include<bits/stdc++.h>
using namespace std;
char s[1100000],word[15];
int ans,ans1;
bool maybe;
int main() {
gets(word);
gets(s);
for(int i=strlen(word);i>=0;i--) {
word[i+1]=word[i];
word[i]=' ';
}
for(int i=strlen(s);i>=0;i--) {
s[i+1]=s[i];
s[i]=' ';
}
word[strlen(word)]=' ';
s[strlen(s)]=' ';
for(int i=0;i<=strlen(word);i++) {
if(word[i]>='a'&&word[i]<='z') {
word[i]-='a'-'A';
}
}
for(int i=0;i<=strlen(s);i++) {
if(s[i]>='a'&&s[i]<='z') {
s[i]-='a'-'A';
}
}
for(int i=0;i<=strlen(s);i++) {
if(s[i]==word[0]) {
for(int j=1;j<=strlen(word)-1;j++) {
if(word[j]!=s[i+j]) {
break;
}
if(j==strlen(word)-1) {
if(!maybe) {
ans1=i;
maybe=true;
}
ans++;
}
}
}
}
if(ans==0) {
cout<<-1;
}
else {
cout<<ans<<" "<<ans1;
}
return 0;
}