S = eval(input())

SR = S[::-1]

temp =['dream','dreamer','erase','eraser']

T=""

j=0

count=0

while j<=10**5//5:

    j +=1

    for i in temp:

        if i[::-1] == SR[count:len(i)+count]:

            count+=len(i)

            T+=i[::-1]

            if SR==T:

                print('YES')

                exit()

print('NO')
a = ["eraser", "erase", "dreamer", "dream"]

s = eval(input())

for i in range(4):

    s = s.replace(a[i], "")

print((['NO','YES'][s==""]))

S = eval(input())
SR = S[::-1]
temp = ["dream", "dreamer", "erase", "eraser"]
T = ""
j = 0
count = 0
while j <= 10**5 // 5:
    j += 1
    for i in temp:
        if i[::-1] == SR[count : len(i) + count]:
            count += len(i)
            T += i[::-1]
            if SR == T:
                print("YES")
                exit()
print("NO")

a = ["eraser", "erase", "dreamer", "dream"]
s = eval(input())
for i in range(4):
    s = s.replace(a[i], "")
print((["NO", "YES"][s == ""]))

-S = eval(input()) -SR = S[::-1] -temp = ["dream", "dreamer", "erase", "eraser"] -T = "" -j = 0 -count = 0 -while j <= 10**5 // 5: -    j += 1 -    for i in temp: -        if i[::-1] == SR[count : len(i) + count]: -            count += len(i) -            T += i[::-1] -            if SR == T: -                print("YES") -                exit() -print("NO") +a = ["eraser", "erase", "dreamer", "dream"] +s = eval(input()) +for i in range(4): +    s = s.replace(a[i], "") +print((["NO", "YES"][s == ""]))