Language: C++

#include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a) (a).begin(),(a).end()

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  char S;
  cin >> S;

	int rec = strlen(S) - 1;
	while (true) {
		if (rec <= 0) { break; }
		if (S[rec - 4] == 'd'&&
			S[rec - 3] == 'r'&&
			S[rec - 2] == 'e'&&
			S[rec - 1] == 'a'&&
			S[rec] == 'm') {
			rec -= 5;
		} else if (S[rec - 6] == 'd'&&
			S[rec - 5] == 'r'&&
			S[rec - 4] == 'e'&&
			S[rec - 3] == 'a'&&
			S[rec - 2] == 'm'&&
			S[rec - 1] == 'e'&&
			S[rec] == 'r') {
			rec -= 7;
		} else if (S[rec - 4] == 'e'&&
			S[rec - 3] == 'r'&&
			S[rec - 2] == 'a'&&
			S[rec - 1] == 's'&&
			S[rec] == 'e') {
			rec -= 5;
		} else if (S[rec - 5] == 'e'&&
			S[rec - 4] == 'r'&&
			S[rec - 3] == 'a'&&
			S[rec - 2] == 's'&&
			S[rec - 1] == 'e'&&
			S[rec] == 'r') {
			rec -= 6;
		} else {
			ans = false;
			break;
		}
	}

	if (ans == true) {
    cout << "YES";
  } else {
    cout << "NO";
  }
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:26: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   25 |         int rec = strlen(S) - 1;
      |                          ^
      |                          |
      |                          char
In file included from /usr/include/c++/14/cstring:43,
                 from a.cc:6:
/usr/include/string.h:407:35: note:   initializing argument 1 of 'size_t strlen(const char*)'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
a.cc:28:22: error: invalid types 'char[int]' for array subscript
   28 |                 if (S[rec - 4] == 'd'&&
      |                      ^
a.cc:29:26: error: invalid types 'char[int]' for array subscript
   29 |                         S[rec - 3] == 'r'&&
      |                          ^
a.cc:30:26: error: invalid types 'char[int]' for array subscript
   30 |                         S[rec - 2] == 'e'&&
      |                          ^
a.cc:31:26: error: invalid types 'char[int]' for array subscript
   31 |                         S[rec - 1] == 'a'&&
      |                          ^
a.cc:32:26: error: invalid types 'char[int]' for array subscript
   32 |                         S[rec] == 'm') {
      |                          ^
a.cc:34:29: error: invalid types 'char[int]' for array subscript
   34 |                 } else if (S[rec - 6] == 'd'&&
      |                             ^
a.cc:35:26: error: invalid types 'char[int]' for array subscript
   35 |                         S[rec - 5] == 'r'&&
      |                          ^
a.cc:36:26: error: invalid types 'char[int]' for array subscript
   36 |                         S[rec - 4] == 'e'&&
      |                          ^
a.cc:37:26: error: invalid types 'char[int]' for array subscript
   37 |                         S[rec - 3] == 'a'&&
      |                          ^
a.cc:38:26: error: invalid types 'char[int]' for array subscript
   38 |                         S[rec - 2] == 'm'&&
      |                          ^
a.cc:39:26: error: invalid types 'char[int]' for array subscript
   39 |                         S[rec - 1] == 'e'&&
      |                          ^
a.cc:40:26: error: invalid types 'char[int]' for array subscript
   40 |                         S[rec] == 'r') {
      |                          ^
a.cc:42:29: error: invalid types 'char[int]' for array subscript
   42 |                 } else if (S[rec - 4] == 'e'&&
      |                             ^
a.cc:43:26: error: invalid types 'char[int]' for array subscript
   43 |                         S[rec - 3] == 'r'&&
      |                          ^
a.cc:44:26: error: invalid types 'char[int]' for array subscript
   44 |                         S[rec - 2] == 'a'&&
      |                          ^
a.cc:45:26: error: invalid types 'char[int]' for array subscript
   45 |                         S[rec - 1] == 's'&&
      |                          ^
a.cc:46:26: error: invalid types 'char[int]' for array subscript
   46 |                         S[rec] == 'e') {
      |                          ^
a.cc:48:29: error: invalid types 'char[int]' for array subscript
   48 |                 } else if (S[rec - 5] == 'e'&&
      |                             ^
a.cc:49:26: error: invalid types 'char[int]' for array subscript
   49 |                         S[rec - 4] == 'r'&&
      |                          ^
a.cc:50:26: error: invalid types 'char[int]' for array subscript
   50 |                         S[rec - 3] == 'a'&&
      |                          ^
a.cc:51:26: error: invalid types 'char[int]' for array subscript
   51 |                         S[rec - 2] == 's'&&
      |                          ^
a.cc:52:26: error: invalid types 'char[int]' for array subscript
   52 |                         S[rec - 1] == 'e'&&
      |                          ^
a.cc:53:26: error: invalid types 'char[int]' for array subscript
   53 |                         S[rec] == 'r') {
      |                          ^
a.cc:56:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   56 |                         ans = false;
      |                         ^~~
      |                         abs
a.cc:61:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   61 |         if (ans == true) {
      |             ^~~
      |             abs