Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)

int main(){
  string S,T;
  cin >> S;
  
  string dream = "dream";
  string dreamer = "dreamer";
  string erase = "erase";
  string eraser = "eraser";

  
  while(T != S){
    countall = 0;
    count1 = 0;
  for(int i = T.size(); i<T.size()+dream.size(); i++){
    if(S[i] != dream[i-T.size()]){
      count1++;
    }
  }
  if(count1 == 0) T.push_buck(dream);
  if(count1) countall++;
  if(T == s) {
    cout << "YES" << endl;
    break;
  }
    
     count2 = 0;
  for(int i = T.size(); i<T.size()+dreamer.size(); i++){
    if(S[i] != dreamer[i-T.size()]){
      count2++;
    }
  }
  if(count2 == 0) T.push_buck(dreamer);
  if(count2) countall++;
  if(T == s){
    cout << "YES" << endl;
    break;
  }
  
    count3 = 0;
  for(int i = T.size(); i<T.size()+erase.size(); i++){
    if(S[i] != erase[i-T.size()]){
      count3++;
    }
  }
  if(count3 == 0) T.push_buck(erase);
  if(count3) countall++;
  if(T == s){
    cout << "YES" << endl;
    break;
  }
  
    count4 = 0;
  for(int i = T.size(); i<T.size()+eraser.size(); i++){
    if(S[i] != eraser[i-T.size()]){
      count4++;
    }
  }
  if(count4 == 0) T.push_buck(eraser);
  if(count4) countall++;
  if(T == s){
    cout << "YES" << endl;
    break;
  }
  
  if(countall == 4){
    cout << "NO" << endl;
    break;
  }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'countall' was not declared in this scope
   16 |     countall = 0;
      |     ^~~~~~~~
a.cc:17:5: error: 'count1' was not declared in this scope
   17 |     count1 = 0;
      |     ^~~~~~
a.cc:23:21: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_buck'; did you mean 'push_back'?
   23 |   if(count1 == 0) T.push_buck(dream);
      |                     ^~~~~~~~~
      |                     push_back
a.cc:25:11: error: 's' was not declared in this scope
   25 |   if(T == s) {
      |           ^
a.cc:30:6: error: 'count2' was not declared in this scope
   30 |      count2 = 0;
      |      ^~~~~~
a.cc:36:21: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_buck'; did you mean 'push_back'?
   36 |   if(count2 == 0) T.push_buck(dreamer);
      |                     ^~~~~~~~~
      |                     push_back
a.cc:38:11: error: 's' was not declared in this scope
   38 |   if(T == s){
      |           ^
a.cc:43:5: error: 'count3' was not declared in this scope
   43 |     count3 = 0;
      |     ^~~~~~
a.cc:49:21: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_buck'; did you mean 'push_back'?
   49 |   if(count3 == 0) T.push_buck(erase);
      |                     ^~~~~~~~~
      |                     push_back
a.cc:51:11: error: 's' was not declared in this scope
   51 |   if(T == s){
      |           ^
a.cc:56:5: error: 'count4' was not declared in this scope
   56 |     count4 = 0;
      |     ^~~~~~
a.cc:62:21: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_buck'; did you mean 'push_back'?
   62 |   if(count4 == 0) T.push_buck(eraser);
      |                     ^~~~~~~~~
      |                     push_back
a.cc:64:11: error: 's' was not declared in this scope
   64 |   if(T == s){
      |           ^