public static void main ( String args [ ] ) {
  Scanner sc = new Scanner ( System . in ) ;
  char [ ] array = sc . nextLine ( ) . toCharArray ( ) ;
  try {
    for ( int i = array . length - 1 ;
    i >= 0 ;
    i -- ) {
      if ( i >= 6 ) {
        if ( array [ i - 6 ] == 'd' && array [ i - 5 ] == 'r' && array [ i - 4 ] == 'e' && array [ i - 3 ] == 'a' && array [ i - 2 ] == 'm' && array [ i - 1 ] == 'e' && array [ i ] == 'r' ) {
          i -= 6 ;
          continue ;
        }
      }
      if ( i >= 5 ) {
        if ( array [ i - 5 ] == 'e' && array [ i - 4 ] == 'r' && array [ i - 3 ] == 'a' && array [ i - 2 ] == 's' && array [ i - 1 ] == 'e' && array [ i ] == 'r' ) {
          i -= 5 ;
          continue ;
        }
      }
      if ( ( array [ i - 4 ] == 'd' && array [ i - 3 ] == 'r' && array [ i - 2 ] == 'e' && array [ i - 1 ] == 'a' && array [ i ] == 'm' ) || ( array [ i - 4 ] == 'e' && array [ i - 3 ] == 'r' && array [ i - 2 ] == 'a' && array [ i - 1 ] == 's' && array [ i ] == 'e' ) ) {
        i -= 4 ;
      }
      else {
        System . out . println ( "NO" ) ;
        return ;
      }
    }
  }
  catch ( ArrayIndexOutOfBoundsException e ) {
    System . out . println ( "NO" ) ;
    return ;
  }
  System . out . println ( "YES" ) ;
}

public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; char [ ] array = sc . nextLine ( ) . toCharArray ( ) ; try { for ( int i = array . length - 1 ; i >= 0 ; i -- ) { if ( i >= 6 ) { if ( array [ i - 6 ] == ' d ' && array [ i - 5 ] == ' r ' && array [ i - 4 ] == ' e ' && array [ i - 3 ] == ' a ' && array [ i - 2 ] == ' m ' && array [ i - 1 ] == ' e ' && array [ i ] == ' r ' ) { i -= 6 ; continue ; } } if ( i >= 5 ) { if ( array [ i - 5 ] == ' e ' && array [ i - 4 ] == ' r ' && array [ i - 3 ] == ' a ' && array [ i - 2 ] == ' s ' && array [ i - 1 ] == ' e ' && array [ i ] == ' r ' ) { i -= 5 ; continue ; } } if ( ( array [ i - 4 ] == ' d ' && array [ i - 3 ] == ' r ' && array [ i - 2 ] == ' e ' && array [ i - 1 ] == ' a ' && array [ i ] == ' m ' ) || ( array [ i - 4 ] == ' e ' && array [ i - 3 ] == ' r ' && array [ i - 2 ] == ' a ' && array [ i - 1 ] == ' s ' && array [ i ] == ' e ' ) ) { i -= 4 ; } else { System . out . println ( " NO " ) ; return ; } } } catch ( ArrayIndexOutOfBoundsException e ) { System . out . println ( " NO " ) ; return ; } System . out . println ( " YES " ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list)))) (try_statement body: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) 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: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal)) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal))) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal))) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal))) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal))) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (continue_statement))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal)) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal))) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal))) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal))) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (continue_statement))))) (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal)) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal))) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal))) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal)))) right: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal)) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal))) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal))) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal)))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) alternative: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (return_statement)))))) (catch_clause (catch_formal_parameter (catch_type (type_identifier)) name: (identifier)) body: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (return_statement)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))))