Language: C++

// ABC049_C 
#include <iostream> 
#include <string> 
using  namespace std;

int main () {
     // input
    string str;
    cin >> str;
    
    // calculation
    string five, six, seven;
    unsigned  long len = str.length ();
    
    if (len < 5 ) {
        cout << "NO";
         return  0 ;
    } else  if (len == 5 ) {
         if (str == "dream" || str == "erase" ) {
            cout << "YES";
             return  0 ;
        } else {
            cout << "NO";
             return  0 ;
        }
    } else  if (len == 6 ) {
         if (str == "eraser" ) {
            cout << "YES";
             return  0 ;
        } else {
            cout << "NO";
             return  0 ;
        }
    } else  if (len == 7 ) {
         if (str == "dreamer" ) {
            cout << "YES";
             return  0 ;
        } else {
            cout << "NO";
             return  0 ;
        }
    } else {
         while (str.length() != 0 ) {
            = Str.Substr five (Str.Size () - 1 - 4 , 5 );
             an if (five == "dream" || five == "erase" ) {
                Str.Erase (Str.End () - 5 , Str.End ());
            } else {
                = Str.Substr six (Str.Size () - 1 - 5 , 6 );
                 an if (six == "eraser" ) {
                    Str.Erase (Str.End () - 6 , Str.End ());
                } else {
                    = Str.Substr seven (Str.Size () - 1 - 6 , 7 );
                     an if (seven == "dreamer" ) {
                        Str.Erase (Str.End () - 7 , Str.End ());
                    } else {
                        cout << "NO" << "\n" ;
                         return  0 ;
                    }
                }
            }
        }
        cout << "YES" << "\n" ;
         return  0 ;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:13: error: expected primary-expression before '=' token
   44 |             = Str.Substr five (Str.Size () - 1 - 4 , 5 );
      |             ^
a.cc:44:15: error: 'Str' was not declared in this scope; did you mean 'str'?
   44 |             = Str.Substr five (Str.Size () - 1 - 4 , 5 );
      |               ^~~
      |               str
a.cc:45:14: error: 'an' was not declared in this scope
   45 |              an if (five == "dream" || five == "erase" ) {
      |              ^~
a.cc:47:15: error: 'else' without a previous 'if'
   47 |             } else {
      |               ^~~~
a.cc:48:17: error: expected primary-expression before '=' token
   48 |                 = Str.Substr six (Str.Size () - 1 - 5 , 6 );
      |                 ^
a.cc:49:20: error: expected ';' before 'if'
   49 |                  an if (six == "eraser" ) {
      |                    ^~~
      |                    ;
a.cc:51:19: error: 'else' without a previous 'if'
   51 |                 } else {
      |                   ^~~~
a.cc:52:21: error: expected primary-expression before '=' token
   52 |                     = Str.Substr seven (Str.Size () - 1 - 6 , 7 );
      |                     ^
a.cc:53:24: error: expected ';' before 'if'
   53 |                      an if (seven == "dreamer" ) {
      |                        ^~~
      |                        ;
a.cc:55:23: error: 'else' without a previous 'if'
   55 |                     } else {
      |                       ^~~~