# coding: utf-8

# Your code here!

S = eval(input())

N = len(S)



S = S[::-1]

#print(S)

L = ['maerd', 'remaerd', 'esare', 'resare']



while len(S) > 0:

    if S[:5] in L:

        S = S[5:]

    elif S[:6] in L:

        S = S[6:]

    elif S[:7] in L:

        S = S[7:]

    else:

        print('NO')

        break

if len(S) == 0:

    print('YES')
# coding: utf-8

import math

#n = int(input())

#x, y = map(int,input().split())

#A = list(map(int,input().split()))

ans = 0

s = eval(input())

n = len(s)

s=s[::-1]

i=0

flg=True

while True:

    if i>=n:

        break

    if s[i:i+7]=="remaerd":

        i+=7

    elif s[i:i+6]=="resare":

        i+=6

    elif s[i:i+5]=="maerd" or s[i:i+5]=="esare":

        i+=5

    else:

        flg=False

        break

if flg:

    print("YES")

else:

    print("NO")
# coding: utf-8
# Your code here!
S = eval(input())
N = len(S)
S = S[::-1]
# print(S)
L = ["maerd", "remaerd", "esare", "resare"]
while len(S) > 0:
    if S[:5] in L:
        S = S[5:]
    elif S[:6] in L:
        S = S[6:]
    elif S[:7] in L:
        S = S[7:]
    else:
        print("NO")
        break
if len(S) == 0:
    print("YES")

# coding: utf-8
import math

# n = int(input())
# x, y = map(int,input().split())
# A = list(map(int,input().split()))
ans = 0
s = eval(input())
n = len(s)
s = s[::-1]
i = 0
flg = True
while True:
    if i >= n:
        break
    if s[i : i + 7] == "remaerd":
        i += 7
    elif s[i : i + 6] == "resare":
        i += 6
    elif s[i : i + 5] == "maerd" or s[i : i + 5] == "esare":
        i += 5
    else:
        flg = False
        break
if flg:
    print("YES")
else:
    print("NO")

-# Your code here! -S = eval(input()) -N = len(S) -S = S[::-1] -# print(S) -L = ["maerd", "remaerd", "esare", "resare"] -while len(S) > 0: -    if S[:5] in L: -        S = S[5:] -    elif S[:6] in L: -        S = S[6:] -    elif S[:7] in L: -        S = S[7:] +import math + +# n = int(input()) +# x, y = map(int,input().split()) +# A = list(map(int,input().split())) +ans = 0 +s = eval(input()) +n = len(s) +s = s[::-1] +i = 0 +flg = True +while True: +    if i >= n: +        break +    if s[i : i + 7] == "remaerd": +        i += 7 +    elif s[i : i + 6] == "resare": +        i += 6 +    elif s[i : i + 5] == "maerd" or s[i : i + 5] == "esare": +        i += 5 -        print("NO") +        flg = False -if len(S) == 0: +if flg: +else: +    print("NO")