#include<bits/stdc++.h>
using namespace std;
int main(){
string a,b;
cin>>a>>b;
if(a.size()!=b.size()){ //情况一
cout<<1;
}else if(a==b){ //情况二
cout<<2;
}else{
bool f=true;
for(int i=0;i<a.length();i++){
if(tolower(a[i])!=tolower(b[i])){
f=false;
break;
}
}
if(f){ //情况三
cout<<3;
}else{ //情况四
cout<<4;
}
}
return 0;
}