static String digitPartition ( int X ) {
  String num = String . valueOf ( X ) ;
  int l = num . length ( ) ;
  int [ ] a = new int [ l ] ;
  for ( int i = 0 ;
  i < l ;
  i ++ ) a [ i ] = ( num . charAt ( i ) - '0' ) ;
  for ( int D = 0 ;
  D < 10 ;
  D ++ ) {
    String res = "" ;
    for ( int i = 0 ;
    i < l ;
    i ++ ) {
      if ( a [ i ] < D ) res += 'A' ;
      else if ( a [ i ] > D ) res += 'B' ;
      else res += 'C' ;
    }
    boolean flag = false ;
    for ( int i = 0 ;
    i < l ;
    i ++ ) {
      if ( res . charAt ( i ) == 'B' ) flag = true ;
      if ( res . charAt ( i ) == 'C' ) res = res . substring ( 0 , i ) + ( flag ? 'A' : 'B' ) + res . substring ( i + 1 ) ;
    }
    Vector < Integer > seq = makeSeq ( res , a ) ;
    if ( checkSeq ( seq ) ) return res ;
  }
  return "-1" ;
}

static String digitPartition ( int X ) { String num = String . valueOf ( X ) ; int l = num . length ( ) ; int [ ] a = new int [ l ] ; for ( int i = 0 ; i < l ; i ++ ) a [ i ] = ( num . charAt ( i ) - '0' ) ; for ( int D = 0 ; D < 10 ; D ++ ) { String res = " " ; for ( int i = 0 ; i < l ; i ++ ) { if ( a [ i ] < D ) res += ' A ' ; else if ( a [ i ] > D ) res += ' B ' ; else res += ' C ' ; } boolean flag = false ; for ( int i = 0 ; i < l ; i ++ ) { if ( res . charAt ( i ) == ' B ' ) flag = true ; if ( res . charAt ( i ) == ' C ' ) res = res . substring ( 0 , i ) + ( flag ? ' A ' : ' B ' ) + res . substring ( i + 1 ) ; } Vector < Integer > seq = makeSeq ( res , a ) ; if ( checkSeq ( seq ) ) return res ; } return " - 1" ; }
(method_declaration (modifiers) type: (type_identifier) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) 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: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (string_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: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) consequence: (expression_statement (assignment_expression left: (identifier) right: (character_literal))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) consequence: (expression_statement (assignment_expression left: (identifier) right: (character_literal))) alternative: (expression_statement (assignment_expression left: (identifier) right: (character_literal))))))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (false))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (character_literal))) consequence: (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: (character_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier))) right: (parenthesized_expression (ternary_expression condition: (identifier) consequence: (character_literal) alternative: (character_literal)))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))))))))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier))))) (if_statement condition: (parenthesized_expression (method_invocation name: (identifier) arguments: (argument_list (identifier)))) consequence: (return_statement (identifier))))) (return_statement (string_literal))))