S=eval(input())

S = S.replace('eraser', '')

S = S.replace('erase', '')

S = S.replace('dreamer', '')

S = S.replace('dream', '')

S=len(S)

if S==0:

    print('YES')

else:

    print('NO')
import re

s=eval(input())

s=re.sub('eraser','',s)

s=re.sub('erase','',s)

s=re.sub('dreamer','',s)

s=re.sub('dream','',s)

if s=='':

    print('YES')

else:

    print('NO')
S = eval(input())
S = S.replace("eraser", "")
S = S.replace("erase", "")
S = S.replace("dreamer", "")
S = S.replace("dream", "")
S = len(S)
if S == 0:
    print("YES")
else:
    print("NO")

import re

s = eval(input())
s = re.sub("eraser", "", s)
s = re.sub("erase", "", s)
s = re.sub("dreamer", "", s)
s = re.sub("dream", "", s)
if s == "":
    print("YES")
else:
    print("NO")

-S = eval(input()) -S = S.replace("eraser", "") -S = S.replace("erase", "") -S = S.replace("dreamer", "") -S = S.replace("dream", "") -S = len(S) -if S == 0: +import re + +s = eval(input()) +s = re.sub("eraser", "", s) +s = re.sub("erase", "", s) +s = re.sub("dreamer", "", s) +s = re.sub("dream", "", s) +if s == "":