#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int dx[4] = {-1, 0, 0, 1};
const int dy[4] = {0, -1, 1, 0};
const int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
const string dir8[8] = {"U", "RU", "R", "RD", "D", "LD", "L", "LU"};

// Self settings
// clang-format off
#define MAX_N 100000
#define MAX 100000
#define INFTY (1<<30)
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1000100011;
class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Point p) { return Point(x + p.x, y + p.y); } Point operator-(Point p) { return Point(x - p.x, y - p.y); } Point operator*(double a) { return Point(a * x, a * y); } Point operator/(double a) { return Point(x / a, y / a); } double abs() { return sqrt(norm()); } double norm() { return x * x + y * y; } bool operator<(const Point& p) const { return x != p.x ? x < p.x : y < p.y; } bool operator==(const Point& p) const { return fabs(x - p.y) < EPS && fabs(y - p.y) < EPS; } };
typedef Point Vector;
double norm(Vector a) { return a.x * a.x + a.y * a.y; }
double abs(Vector a) { return sqrt(norm(a));}
double dot(Vector a, Vector b) { return a.x * b.x + a.y * b.y; }
double cross(Vector a, Vector b) { return a.x * b.y - a.y * b.x; }
struct Segment { Point p1, p2; };
typedef Segment Line;
// clang-format on

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;

  for (int i = S.size() - 1; i >= 0; i--) {
    if (S[i] == 'r') {
      i--;
      if (S[i] != 'e') {
        cout << "NO" << endl;
        return 0;
      };
      i--;
      if (i - 3 >= 0 && S[i] == 's' && S[i - 1] == 'a' && S[i - 2] == 'r' &&
          S[i - 3] == 'e') {
        i -= 3;
        continue;

      } else if (i - 4 >= 0 && S[i] == 'm' && S[i - 1] == 'a' &&
                 S[i - 2] == 'e' && S[i - 3] == 'r' && S[i - 4] == 'd') {
        i -= 4;
        continue;
      } else {
        cout << "NO" << endl;
        return 0;
      }
    } else if (S[i] == 'e') {
      i--;
      if (i - 3 >= 0 && S[i] == 's' && S[i - 1] == 'a' && S[i - 2] == 'r' &&
          S[i - 3] == 'e') {
        i -= 3;
        continue;
      } else {
        cout << "NO" << endl;
        return 0;
      }
    } else if (S[i] == 'm') {
      i--;
      if (i - 3 >= 0 && S[i] == 'a' && S[i - 1] == 'e' && S[i - 2] == 'r' &&
          S[i - 3] == 'd') {
        i -= 3;
        continue;
      } else {
        cout << "NO" << endl;
        return 0;
      }
    }
  }

  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 512