public static boolean Solve ( String s1 , String s2 ) {
  if ( s1 . length ( ) != s2 . length ( ) || s1 . equals ( s2 ) ) return false ;
  int i = 0 ;
  int j = s1 . length ( ) - 1 ;
  boolean flagi = false ;
  boolean flagj = false ;
  boolean flag = false ;
  while ( j > i ) {
    if ( s1 . charAt ( i ) == s2 . charAt ( i ) ) i ++ ;
    else {
      if ( flag ) return false ;
      flagi = true ;
    }
    if ( s1 . charAt ( j ) == s2 . charAt ( j ) ) j -- ;
    else {
      if ( flag ) return false ;
      flagj = true ;
    }
    if ( flagi && flagj ) {
      if ( s1 . charAt ( i ) == s2 . charAt ( j ) && s1 . charAt ( j ) == s2 . charAt ( i ) ) {
        flag = true ;
        i ++ ;
        j -- ;
      }
      else return false ;
      flagi = flagj = false ;
    }
  }
  return flag ;
}

public static boolean Solve ( String s1 , String s2 ) { if ( s1 . length ( ) != s2 . length ( ) || s1 . equals ( s2 ) ) return false ; int i = 0 ; int j = s1 . length ( ) - 1 ; boolean flagi = false ; boolean flagj = false ; boolean flag = false ; while ( j > i ) { if ( s1 . charAt ( i ) == s2 . charAt ( i ) ) i ++ ; else { if ( flag ) return false ; flagi = true ; } if ( s1 . charAt ( j ) == s2 . charAt ( j ) ) j -- ; else { if ( flag ) return false ; flagj = true ; } if ( flagi && flagj ) { if ( s1 . charAt ( i ) == s2 . charAt ( j ) && s1 . charAt ( j ) == s2 . charAt ( i ) ) { flag = true ; i ++ ; j -- ; } else return false ; flagi = flagj = false ; } } return flag ; }
(method_declaration (modifiers) type: (boolean_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier)) (formal_parameter type: (type_identifier) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) consequence: (return_statement (false))) (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: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (false))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (false))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (false))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) consequence: (expression_statement (update_expression (identifier))) alternative: (block (if_statement condition: (parenthesized_expression (identifier)) consequence: (return_statement (false))) (expression_statement (assignment_expression left: (identifier) right: (true))))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) consequence: (expression_statement (update_expression (identifier))) alternative: (block (if_statement condition: (parenthesized_expression (identifier)) consequence: (return_statement (false))) (expression_statement (assignment_expression left: (identifier) right: (true))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (true))) (expression_statement (update_expression (identifier))) (expression_statement (update_expression (identifier)))) alternative: (return_statement (false))) (expression_statement (assignment_expression left: (identifier) right: (assignment_expression left: (identifier) right: (false)))))))) (return_statement (identifier))))