import numpy as np

import scipy.sparse as sps

import scipy.misc as spm

import collections as col

import functools as func

import itertools as ite

import fractions as frac

import math as ma

from math import cos,sin,tan

import cmath as cma

import copy as cp

import sys

def sinput(): return sys.stdin.readline().strip()

def iinput(): return int(sinput())

def imap(): return list(map(int, sinput().split()))

def fmap(): return list(map(float, sinput().split()))

def iarr(n=0):

    if n: return [0 for _ in range(n)]

    else: return list(map())

def farr(): return list(fmap())

def sarr(n=0):

    if n: return ["" for _ in range(n)]

    else: return sinput().split()

def barr(n): return [False for _ in range(n)]

sys.setrecursionlimit(10**7)

MOD = 10**9 + 7; EPS = sys.float_info.epsilon

PI = np.pi; EXP = np.e; INF = np.inf



s = sinput()[::-1]



a = "dream"[::-1]

b = "dreamer"[::-1]

c = "erase"[::-1]

d = "eraser"[::-1]



s = "".join(s.split(d))

s = "".join(s.split(c))

s = "".join(s.split(b))

s = "".join(s.split(a))



ans = "YES" if s=="" else "NO"

print(ans)

import numpy as np

import scipy.sparse as sps

import scipy.misc as spm

import collections as col

import functools as func

import itertools as ite

import fractions as frac

import math as ma

from math import cos,sin,tan

import cmath as cma

import copy as cp

import sys

def sinput(): return sys.stdin.readline().strip()

def iinput(): return int(sinput())

def imap(): return list(map(int, sinput().split()))

def fmap(): return list(map(float, sinput().split()))

def iarr(n=0):

    if n: return [0 for _ in range(n)]

    else: return list(map())

def farr(): return list(fmap())

def sarr(n=0):

    if n: return ["" for _ in range(n)]

    else: return sinput().split()

def barr(n): return [False for _ in range(n)]

sys.setrecursionlimit(10**7)

MOD = 10**9 + 7; EPS = sys.float_info.epsilon

PI = np.pi; EXP = np.e; INF = np.inf



s = sinput()



a = "dream"

b = "dreamer"

c = "erase"

d = "eraser"



s = "".join(s.split(d))

s = "".join(s.split(c))

s = "".join(s.split(b))

s = "".join(s.split(a))



ans = "YES" if s=="" else "NO"

print(ans)

import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
from math import cos, sin, tan
import cmath as cma
import copy as cp
import sys


def sinput():
    return sys.stdin.readline().strip()


def iinput():
    return int(sinput())


def imap():
    return list(map(int, sinput().split()))


def fmap():
    return list(map(float, sinput().split()))


def iarr(n=0):
    if n:
        return [0 for _ in range(n)]
    else:
        return list(map())


def farr():
    return list(fmap())


def sarr(n=0):
    if n:
        return ["" for _ in range(n)]
    else:
        return sinput().split()


def barr(n):
    return [False for _ in range(n)]


sys.setrecursionlimit(10**7)
MOD = 10**9 + 7
EPS = sys.float_info.epsilon
PI = np.pi
EXP = np.e
INF = np.inf
s = sinput()[::-1]
a = "dream"[::-1]
b = "dreamer"[::-1]
c = "erase"[::-1]
d = "eraser"[::-1]
s = "".join(s.split(d))
s = "".join(s.split(c))
s = "".join(s.split(b))
s = "".join(s.split(a))
ans = "YES" if s == "" else "NO"
print(ans)

import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
from math import cos, sin, tan
import cmath as cma
import copy as cp
import sys


def sinput():
    return sys.stdin.readline().strip()


def iinput():
    return int(sinput())


def imap():
    return list(map(int, sinput().split()))


def fmap():
    return list(map(float, sinput().split()))


def iarr(n=0):
    if n:
        return [0 for _ in range(n)]
    else:
        return list(map())


def farr():
    return list(fmap())


def sarr(n=0):
    if n:
        return ["" for _ in range(n)]
    else:
        return sinput().split()


def barr(n):
    return [False for _ in range(n)]


sys.setrecursionlimit(10**7)
MOD = 10**9 + 7
EPS = sys.float_info.epsilon
PI = np.pi
EXP = np.e
INF = np.inf
s = sinput()
a = "dream"
b = "dreamer"
c = "erase"
d = "eraser"
s = "".join(s.split(d))
s = "".join(s.split(c))
s = "".join(s.split(b))
s = "".join(s.split(a))
ans = "YES" if s == "" else "NO"
print(ans)

-s = sinput()[::-1] -a = "dream"[::-1] -b = "dreamer"[::-1] -c = "erase"[::-1] -d = "eraser"[::-1] +s = sinput() +a = "dream" +b = "dreamer" +c = "erase" +d = "eraser"