#include #include int abs( int x ) { return x >= 0 ? x : -x; } int cm( int x1, int y1, int x2, int y2 ) { return x1 == x2 || y1 == y2 || y1-abs(5-x1) == y2-abs(5-x2); } int main() { char src[4], dst[4]; scanf( "%s %s", src, dst ); int a = src[0]-'a', b = 11-atoi(src+1); int e = dst[0]-'a', f = 11-atoi(dst+1); int num = 0; for( int c = 0; c < 11; ++c ) for( int d = 0; d < 11; ++ d ) if( c+d >= 5 && c-d <= 5 ) if( ( c != a || d != b ) && ( c != e || d != f ) ) num += cm(a,b,c,d) && cm(c,d,e,f); printf( "%d\n", num ); }