#include<bits/stdc++.h>
using namespace std;
int t,t1,x=0,x1;
bool ans[105];
char s[105],l[105],l1[105];
int main(){
cin>>l;
cin>>s;
if(l[0]>=97&&l[0]<=122){
l1[0]=l[0]-32;
}
if(l[0]>=65&&l[0]<=90){
l1[0]=l[0]+32;
}
for(int i=0;i<strlen(s);i++){
if(s[i]>122||s[i]<65){
for(int j=0;j<i;j++){
if(s[j]==l[j]||s[j]==l1[j]) ans[j]=true;t++;
}
}
}
int c=strlen(l);
for(int i=0;i<=t;i++){
if(ans[i]==true){
for(int j=0;j<c;j++){
if(l[j]==s[j]||l1[j]==s[j]) x1++;x=i;
}
}
}
cout<<x1<<" "<<x<<endl;
return 0;
}