Language: C++

#include <iostream>
usign namespace std;
int main()
{
	string divide[4] = { "dream", "dreamer", "erase", "eraser" };
	string S;
	cin >> S;

	reverse(S.begin(), S.end());
	for (int i = 0; i < 4; ++i) reverse(divide[i].begin(), divide[i].end());

	bool can = true;
	for (int i = 0; i < S.size();) {
		bool can2 = false;
		for (int j = 0; j < 4; ++j)
		{
			string d = divide[j];
			if (S.substr(i, d.size()) == d) {
				can2 = true;
				i += d.size();
			}
		}
		if (!can2) {
			can = false;
			break;
		}
	}

	if (can) cout << "YES" << endl;
	else cout << "NO" << endl;
    return 0;
}

Compiler output:
a.cc:2:1: error: 'usign' does not name a type
    2 | usign namespace std;
      | ^~~~~
a.cc: In function 'int main()':
a.cc:5:9: error: 'string' was not declared in this scope
    5 |         string divide[4] = { "dream", "dreamer", "erase", "eraser" };
      |         ^~~~~~
a.cc:5:9: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:6:15: error: expected ';' before 'S'
    6 |         string S;
      |               ^~
      |               ;
a.cc:7:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 |         cin >> S;
      |         ^~~
      |         std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:7:16: error: 'S' was not declared in this scope
    7 |         cin >> S;
      |                ^
a.cc:9:9: error: 'reverse' was not declared in this scope
    9 |         reverse(S.begin(), S.end());
      |         ^~~~~~~
a.cc:10:45: error: 'divide' was not declared in this scope
   10 |         for (int i = 0; i < 4; ++i) reverse(divide[i].begin(), divide[i].end());
      |                                             ^~~~~~
a.cc:17:31: error: expected ';' before 'd'
   17 |                         string d = divide[j];
      |                               ^~
      |                               ;
a.cc:18:41: error: 'd' was not declared in this scope
   18 |                         if (S.substr(i, d.size()) == d) {
      |                                         ^
a.cc:29:18: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   29 |         if (can) cout << "YES" << endl;
      |                  ^~~~
      |                  std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:29:35: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   29 |         if (can) cout << "YES" << endl;
      |                                   ^~~~
      |                                   std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:30:14: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   30 |         else cout << "NO" << endl;
      |              ^~~~
      |              std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:30:30: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   30 |         else cout << "NO" << endl;
      |                              ^~~~
      |                              std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~