# -*- coding: utf-8 -*-



""" 逆順使わないでDPでやる版 """



S = eval(input())



dp = [False] * (len(S)+1)

# 0文字地点は遡る用にTrueにしておく

dp[0] = True



for i in range(1, len(dp)):

    if i-5 >= 0:

        if S[i-5:i] == "dream" or S[i-5:i] == "erase":

            # 条件に当てはまったら、文字数分遡って有効な文字列が続いているか確認

            if dp[i-5]:

                dp[i] = True

    if i-6 >= 0:

        if S[i-6:i] == "eraser":

            if dp[i-6]:

                dp[i] = True

    if i-7 >= 0:

        if S[i-7:i] == "dreamer":

            if dp[i-7]:

                dp[i] = True



if dp[len(S)]:

    print("YES")

else:

    print("NO")
# -*- coding: utf-8 -*-



import sys



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

def list2d(a, b, c): return [[c] * b for i in range(a)]

def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1): return int(-(-x // y))

def INT(): return int(eval(input()))

def MAP(): return list(map(int, input().split()))

def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes(): print('Yes')

def No(): print('No')

def YES(): print('YES')

def NO(): print('NO')

sys.setrecursionlimit(10 ** 9)

INF = 10 ** 18

MOD = 10 ** 9 + 7



S = eval(input())

N = len(S)



# dp[i] := i文字目までをS=Tとすることができるか

dp = [0] * (N + 9)

dp[0] = 1

for i in range(N):

    if dp[i]:

        if S[i:i+5] == 'dream':

            dp[i+5] = 1

        if S[i:i+7] == 'dreamer':

            dp[i+7] = 1

        if S[i:i+5] == 'erase':

            dp[i+5] = 1

        if S[i:i+6] == 'eraser':

            dp[i+6] = 1

if dp[N]:

    YES()

else:

    NO()

# -*- coding: utf-8 -*-
""" 逆順使わないでDPでやる版 """
S = eval(input())
dp = [False] * (len(S) + 1)
# 0文字地点は遡る用にTrueにしておく
dp[0] = True
for i in range(1, len(dp)):
    if i - 5 >= 0:
        if S[i - 5 : i] == "dream" or S[i - 5 : i] == "erase":
            # 条件に当てはまったら、文字数分遡って有効な文字列が続いているか確認
            if dp[i - 5]:
                dp[i] = True
    if i - 6 >= 0:
        if S[i - 6 : i] == "eraser":
            if dp[i - 6]:
                dp[i] = True
    if i - 7 >= 0:
        if S[i - 7 : i] == "dreamer":
            if dp[i - 7]:
                dp[i] = True
if dp[len(S)]:
    print("YES")
else:
    print("NO")

# -*- coding: utf-8 -*-
import sys


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


def list2d(a, b, c):
    return [[c] * b for i in range(a)]


def list3d(a, b, c, d):
    return [[[d] * c for j in range(b)] for i in range(a)]


def list4d(a, b, c, d, e):
    return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]


def ceil(x, y=1):
    return int(-(-x // y))


def INT():
    return int(eval(input()))


def MAP():
    return list(map(int, input().split()))


def LIST(N=None):
    return list(MAP()) if N is None else [INT() for i in range(N)]


def Yes():
    print("Yes")


def No():
    print("No")


def YES():
    print("YES")


def NO():
    print("NO")


sys.setrecursionlimit(10**9)
INF = 10**18
MOD = 10**9 + 7
S = eval(input())
N = len(S)
# dp[i] := i文字目までをS=Tとすることができるか
dp = [0] * (N + 9)
dp[0] = 1
for i in range(N):
    if dp[i]:
        if S[i : i + 5] == "dream":
            dp[i + 5] = 1
        if S[i : i + 7] == "dreamer":
            dp[i + 7] = 1
        if S[i : i + 5] == "erase":
            dp[i + 5] = 1
        if S[i : i + 6] == "eraser":
            dp[i + 6] = 1
if dp[N]:
    YES()
else:
    NO()

-""" 逆順使わないでDPでやる版 """ +import sys + + +def input(): +    return sys.stdin.readline().strip() + + +def list2d(a, b, c): +    return [[c] * b for i in range(a)] + + +def list3d(a, b, c, d): +    return [[[d] * c for j in range(b)] for i in range(a)] + + +def list4d(a, b, c, d, e): +    return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)] + + +def ceil(x, y=1): +    return int(-(-x // y)) + + +def INT(): +    return int(eval(input())) + + +def MAP(): +    return list(map(int, input().split())) + + +def LIST(N=None): +    return list(MAP()) if N is None else [INT() for i in range(N)] + + +def Yes(): +    print("Yes") + + +def No(): +    print("No") + + +def YES(): +    print("YES") + + +def NO(): +    print("NO") + + +sys.setrecursionlimit(10**9) +INF = 10**18 +MOD = 10**9 + 7 -dp = [False] * (len(S) + 1) -# 0文字地点は遡る用にTrueにしておく -dp[0] = True -for i in range(1, len(dp)): -    if i - 5 >= 0: -        if S[i - 5 : i] == "dream" or S[i - 5 : i] == "erase": -            # 条件に当てはまったら、文字数分遡って有効な文字列が続いているか確認 -            if dp[i - 5]: -                dp[i] = True -    if i - 6 >= 0: -        if S[i - 6 : i] == "eraser": -            if dp[i - 6]: -                dp[i] = True -    if i - 7 >= 0: -        if S[i - 7 : i] == "dreamer": -            if dp[i - 7]: -                dp[i] = True -if dp[len(S)]: -    print("YES") +N = len(S) +# dp[i] := i文字目までをS=Tとすることができるか +dp = [0] * (N + 9) +dp[0] = 1 +for i in range(N): +    if dp[i]: +        if S[i : i + 5] == "dream": +            dp[i + 5] = 1 +        if S[i : i + 7] == "dreamer": +            dp[i + 7] = 1 +        if S[i : i + 5] == "erase": +            dp[i + 5] = 1 +        if S[i : i + 6] == "eraser": +            dp[i + 6] = 1 +if dp[N]: +    YES() -    print("NO") +    NO()