public static void main ( String [ ] args ) {
  Scanner sc = new Scanner ( System . in ) ;
  String rook = sc . next ( ) ;
  String knight = sc . next ( ) ;
  int r = knight . charAt ( 0 ) - 'a' + 1 ;
  int c = knight . charAt ( 1 ) - '0' ;
  boolean m [ ] [ ] = new boolean [ 9 ] [ 9 ] ;
  int r1 = rook . charAt ( 0 ) - 'a' + 1 ;
  int c1 = rook . charAt ( 1 ) - '0' ;
  for ( int i = 1 ;
  i <= 8 ;
  i ++ ) m [ r1 ] [ i ] = true ;
  for ( int i = 1 ;
  i <= 8 ;
  i ++ ) m [ i ] [ c1 ] = true ;
  int dx [ ] = {
    2 , 2 , - 2 , - 2 , 1 , 1 , - 1 , - 1 };
    int dy [ ] = {
      - 1 , 1 , - 1 , 1 , 2 , - 2 , 2 , - 2 };
      int ans = 0 ;
      int x = 0 , y = 0 ;
      m [ r ] [ c ] = true ;
      for ( int i = 0 ;
      i < 8 ;
      i ++ ) {
        x = r + dx [ i ] ;
        y = c + dy [ i ] ;
        if ( x < 1 || y < 1 || x > 8 || y > 8 ) continue ;
        m [ x ] [ y ] = true ;
      }
      for ( int i = 1 ;
      i <= 8 ;
      i ++ ) {
        for ( int j = 1 ;
        j <= 8 ;
        j ++ ) {
          if ( ! m [ i ] [ j ] ) {
            boolean place = true ;
            for ( int k = 0 ;
            k < 8 ;
            k ++ ) {
              x = i + dx [ k ] ;
              y = j + dy [ k ] ;
              if ( x == r1 && y == c1 ) place = false ;
            }
            if ( place ) ans ++ ;
          }
        }
      }
      System . out . println ( ans ) ;
    }
    
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String rook = sc . next ( ) ; String knight = sc . next ( ) ; int r = knight . charAt ( 0 ) - ' a ' + 1 ; int c = knight . charAt ( 1 ) - '0' ; boolean m [ ] [ ] = new boolean [ 9 ] [ 9 ] ; int r1 = rook . charAt ( 0 ) - ' a ' + 1 ; int c1 = rook . charAt ( 1 ) - '0' ; for ( int i = 1 ; i <= 8 ; i ++ ) m [ r1 ] [ i ] = true ; for ( int i = 1 ; i <= 8 ; i ++ ) m [ i ] [ c1 ] = true ; int dx [ ] = { 2 , 2 , - 2 , - 2 , 1 , 1 , - 1 , - 1 } ; int dy [ ] = { - 1 , 1 , - 1 , 1 , 2 , - 2 , 2 , - 2 } ; int ans = 0 ; int x = 0 , y = 0 ; m [ r ] [ c ] = true ; for ( int i = 0 ; i < 8 ; i ++ ) { x = r + dx [ i ] ; y = c + dy [ i ] ; if ( x < 1 || y < 1 || x > 8 || y > 8 ) continue ; m [ x ] [ y ] = true ; } for ( int i = 1 ; i <= 8 ; i ++ ) { for ( int j = 1 ; j <= 8 ; j ++ ) { if ( ! m [ i ] [ j ] ) { boolean place = true ; for ( int k = 0 ; k < 8 ; k ++ ) { x = i + dx [ k ] ; y = j + dy [ k ] ; if ( x == r1 && y == c1 ) place = false ; } if ( place ) ans ++ ; } } } System . out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (character_literal)) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (character_literal)))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (boolean_type) dimensions: (dimensions_expr (decimal_integer_literal)) dimensions: (dimensions_expr (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (character_literal)) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (character_literal)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (true)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (true)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_initializer (decimal_integer_literal) (decimal_integer_literal) (unary_expression operand: (decimal_integer_literal)) (unary_expression operand: (decimal_integer_literal)) (decimal_integer_literal) (decimal_integer_literal) (unary_expression operand: (decimal_integer_literal)) (unary_expression operand: (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_initializer (unary_expression operand: (decimal_integer_literal)) (decimal_integer_literal) (unary_expression operand: (decimal_integer_literal)) (decimal_integer_literal) (decimal_integer_literal) (unary_expression operand: (decimal_integer_literal)) (decimal_integer_literal) (unary_expression operand: (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (true))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (continue_statement)) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (true))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (unary_expression operand: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))) consequence: (block (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (true))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (expression_statement (assignment_expression left: (identifier) right: (false)))))) (if_statement condition: (parenthesized_expression (identifier)) consequence: (expression_statement (update_expression (identifier)))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))