public static String find ( String s ) {
  char [ ] ch = s . toCharArray ( ) ;
  char [ ] ar = new char [ 26 ] ;
  int i = 0 , j = 0 , ques = 0 ;
  Set < Character > set = new HashSet < Character > ( ) ;
  while ( j < s . length ( ) ) {
    if ( j >= 26 ) {
      if ( ch [ i ] == '?' ) ques -- ;
      else {
        ar [ ch [ i ] - 'A' ] -- ;
        if ( ar [ ch [ i ] - 'A' ] == 0 ) set . remove ( ch [ i ] ) ;
      }
      i ++ ;
    }
    if ( ch [ j ] == '?' ) ques ++ ;
    else {
      ar [ ch [ j ] - 'A' ] ++ ;
      set . add ( ch [ j ] ) ;
    }
    if ( set . size ( ) + ques == 26 ) {
      String ans = process ( ch , i , j , set ) ;
      if ( ans . equals ( "-1" ) ) return ans ;
      else {
        for ( int x = 0 ;
        x < ch . length ;
        x ++ ) {
          if ( ch [ x ] == '?' ) ch [ x ] = 'A' ;
        }
        return new String ( ch ) ;
      }
    }
    j ++ ;
  }
  return "-1" ;
}

public static String find ( String s ) { char [ ] ch = s . toCharArray ( ) ; char [ ] ar = new char [ 26 ] ; int i = 0 , j = 0 , ques = 0 ; Set < Character > set = new HashSet < Character > ( ) ; while ( j < s . length ( ) ) { if ( j >= 26 ) { if ( ch [ i ] == ' ? ' ) ques -- ; else { ar [ ch [ i ] - ' A ' ] -- ; if ( ar [ ch [ i ] - ' A ' ] == 0 ) set . remove ( ch [ i ] ) ; } i ++ ; } if ( ch [ j ] == ' ? ' ) ques ++ ; else { ar [ ch [ j ] - ' A ' ] ++ ; set . add ( ch [ j ] ) ; } if ( set . size ( ) + ques == 26 ) { String ans = process ( ch , i , j , set ) ; if ( ans . equals ( " - 1" ) ) return ans ; else { for ( int x = 0 ; x < ch . length ; x ++ ) { if ( ch [ x ] == ' ? ' ) ch [ x ] = ' A ' ; } return new String ( ch ) ; } } j ++ ; } return " - 1" ; }
(method_declaration (modifiers) type: (type_identifier) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) 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 (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)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments (type_identifier))) arguments: (argument_list)))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) consequence: (expression_statement (update_expression (identifier))) alternative: (block (expression_statement (update_expression (array_access array: (identifier) index: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))))))) (expression_statement (update_expression (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) consequence: (expression_statement (update_expression (identifier))) alternative: (block (expression_statement (update_expression (array_access array: (identifier) index: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (identifier)) right: (decimal_integer_literal))) consequence: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (identifier))))) (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (return_statement (identifier)) alternative: (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: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) consequence: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal)))))) (return_statement (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier)))))))) (expression_statement (update_expression (identifier))))) (return_statement (string_literal))))