#include <iostream>#include <cstring>#include <cmath>using namespace std;
int main(){
char line1[10000]; char line2[10000]; while(cin >> line1 >> line2) { cout << abs(int(line1[0]-'A')-int(line2[0]-'A'))<< endl; }
return 0;}