public static void main ( String [ ] args ) {
  Stack < Character > st = new Stack < > ( ) ;
  char pre = ' ' ;
  for ( char c : new java . util . Scanner ( System . in ) . next ( ) . toCharArray ( ) ) {
    if ( c == pre ) st . pop ( ) ;
    else st . add ( c ) ;
    if ( ! st . isEmpty ( ) ) pre = st . peek ( ) ;
    else pre = ' ' ;
  }
  System . out . println ( st . empty ( ) ? "Yes" : "No" ) ;
}

public static void main ( String [ ] args ) { Stack < Character > st = new Stack < > ( ) ; char pre = ' ▁ ' ; for ( char c : new java . util . Scanner ( System . in ) . next ( ) . toCharArray ( ) ) { if ( c == pre ) st . pop ( ) ; else st . add ( c ) ; if ( ! st . isEmpty ( ) ) pre = st . peek ( ) ; else pre = ' ▁ ' ; } System . out . println ( st . empty ( ) ? " Yes " : " No " ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (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)) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (character_literal))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (method_invocation object: (method_invocation object: (object_creation_expression type: (scoped_type_identifier (scoped_type_identifier (type_identifier) (type_identifier)) (type_identifier)) arguments: (argument_list (field_access object: (identifier) field: (identifier)))) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) alternative: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (unary_expression operand: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) consequence: (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) alternative: (expression_statement (assignment_expression left: (identifier) right: (character_literal)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (ternary_expression condition: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) consequence: (string_literal) alternative: (string_literal)))))))