private static int solve ( int N , String S1 , String S2 ) {
  long ans ;
  boolean prev_tate ;
  int i ;
  if ( S1 . charAt ( 0 ) == S2 . charAt ( 0 ) ) {
    prev_tate = true ;
    i = 1 ;
    ans = 3 ;
  }
  else {
    prev_tate = false ;
    i = 2 ;
    ans = 6 ;
  }
  while ( N > i ) {
    if ( S1 . charAt ( i ) == S2 . charAt ( i ) ) {
      if ( prev_tate ) {
        ans = ans * 2 % MOD ;
      }
      i ++ ;
      prev_tate = true ;
    }
    else {
      if ( prev_tate ) {
        ans = ans * 2 % MOD ;
      }
      else {
        ans = ans * 3 % MOD ;
      }
      i = i + 2 ;
      prev_tate = false ;
    }
  }
  return ( int ) ans ;
}

private static int solve ( int N , String S1 , String S2 ) { long ans ; boolean prev_tate ; int i ; if ( S1 . charAt ( 0 ) == S2 . charAt ( 0 ) ) { prev_tate = true ; i = 1 ; ans = 3 ; } else { prev_tate = false ; i = 2 ; ans = 6 ; } while ( N > i ) { if ( S1 . charAt ( i ) == S2 . charAt ( i ) ) { if ( prev_tate ) { ans = ans * 2 % MOD ; } i ++ ; prev_tate = true ; } else { if ( prev_tate ) { ans = ans * 2 % MOD ; } else { ans = ans * 3 % MOD ; } i = i + 2 ; prev_tate = false ; } } return ( int ) ans ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (type_identifier) name: (identifier)) (formal_parameter type: (type_identifier) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (true))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (false))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (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: (block (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (identifier)))))) (expression_statement (update_expression (identifier))) (expression_statement (assignment_expression left: (identifier) right: (true)))) alternative: (block (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (identifier))))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (false))))))) (return_statement (cast_expression type: (integral_type) value: (identifier)))))