public static void query ( char c , long num ) {
  if ( c == '?' ) {
    if ( h . containsKey ( num ) ) System . out . println ( h . get ( num ) ) ;
    else System . out . println ( "0" ) ;
  }
  else if ( c == '+' || c == '-' ) {
    String s = "" ;
    while ( num != 0 ) {
      long i = num % 10 ;
      if ( i % 2 == 0 ) s += "0" ;
      else s += "1" ;
      num = num / 10 ;
    }
    StringBuilder sb = new StringBuilder ( ) ;
    sb . append ( s ) ;
    sb = sb . reverse ( ) ;
    String temp = new String ( sb ) ;
    num = Long . parseLong ( temp , 10 ) ;
    if ( c == '+' ) {
      if ( h . containsKey ( num ) ) h . put ( num , h . get ( num ) + 1 ) ;
      else h . put ( num , 1 ) ;
    }
    else {
      h . put ( num , h . get ( num ) - 1 ) ;
    }
  }
}

public static void query ( char c , long num ) { if ( c == ' ? ' ) { if ( h . containsKey ( num ) ) System . out . println ( h . get ( num ) ) ; else System . out . println ( "0" ) ; } else if ( c == ' + ' || c == ' - ' ) { String s = " " ; while ( num != 0 ) { long i = num % 10 ; if ( i % 2 == 0 ) s += "0" ; else s += "1" ; num = num / 10 ; } StringBuilder sb = new StringBuilder ( ) ; sb . append ( s ) ; sb = sb . reverse ( ) ; String temp = new String ( sb ) ; num = Long . parseLong ( temp , 10 ) ; if ( c == ' + ' ) { if ( h . containsKey ( num ) ) h . put ( num , h . get ( num ) + 1 ) ; else h . put ( num , 1 ) ; } else { h . put ( num , h . get ( num ) - 1 ) ; } } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (character_literal))) consequence: (block (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) alternative: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal)))) consequence: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (string_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (string_literal))) alternative: (expression_statement (assignment_expression left: (identifier) right: (string_literal)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (character_literal))) consequence: (block (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (decimal_integer_literal))))) alternative: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal)))))) alternative: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (decimal_integer_literal))))))))))))