#include<iostream>
#include<string>
using namespace std;
int main(){
string s1, s2;
cin>>s1>>s2;
if(s1==s2)
cout<<2<<endl;
else if(s1.size()==s2.size()){
int flag=0;
for(int i=0; i<s1.size(); i++)
if(tolower(s1[i])!=tolower(s2[i])){
flag=1;
break;
}
if(flag==0) cout<<3<<endl;
else cout<<4<<endl;
}else
cout<<1<<endl;
return 0;
}