def check():

    S = eval(input())

    dp = [False]*len(S)

    dp[-1]=True

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

        dp[i] = (dp[i-5]&(S[max(0,i-4):i+1]in['dream','erase']))|(dp[i-7]&(S[max(0,i-6):i+1]=='dreamer'))|(dp[i-6]&(S[max(0,i-5):i+1]=='eraser'))



    if dp[-1]:

        return 'YES'

    return 'NO'

print((check()))
def check():

  S = eval(input())

  n = len(S)

  dp = [False]*(n+10)

  dp[0] = True

  for i in range(n+1):

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

      dp[i+5] |= dp[i]

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

      dp[i+7] |= dp[i]

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

      dp[i+5] |= dp[i]

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

      dp[i+6] |= dp[i]

  if dp[n]==True:

    return 'YES'

  return 'NO'

print((check()))
def check():
    S = eval(input())
    dp = [False] * len(S)
    dp[-1] = True
    for i in range(1, len(S)):
        dp[i] = (
            (dp[i - 5] & (S[max(0, i - 4) : i + 1] in ["dream", "erase"]))
            | (dp[i - 7] & (S[max(0, i - 6) : i + 1] == "dreamer"))
            | (dp[i - 6] & (S[max(0, i - 5) : i + 1] == "eraser"))
        )
    if dp[-1]:
        return "YES"
    return "NO"


print((check()))

def check():
    S = eval(input())
    n = len(S)
    dp = [False] * (n + 10)
    dp[0] = True
    for i in range(n + 1):
        if S[i : i + 5] == "dream":
            dp[i + 5] |= dp[i]
        if S[i : i + 7] == "dreamer":
            dp[i + 7] |= dp[i]
        if S[i : i + 5] == "erase":
            dp[i + 5] |= dp[i]
        if S[i : i + 6] == "eraser":
            dp[i + 6] |= dp[i]
    if dp[n] == True:
        return "YES"
    return "NO"


print((check()))

-    dp = [False] * len(S) -    dp[-1] = True -    for i in range(1, len(S)): -        dp[i] = ( -            (dp[i - 5] & (S[max(0, i - 4) : i + 1] in ["dream", "erase"])) -            | (dp[i - 7] & (S[max(0, i - 6) : i + 1] == "dreamer")) -            | (dp[i - 6] & (S[max(0, i - 5) : i + 1] == "eraser")) -        ) -    if dp[-1]: +    n = len(S) +    dp = [False] * (n + 10) +    dp[0] = True +    for i in range(n + 1): +        if S[i : i + 5] == "dream": +            dp[i + 5] |= dp[i] +        if S[i : i + 7] == "dreamer": +            dp[i + 7] |= dp[i] +        if S[i : i + 5] == "erase": +            dp[i + 5] |= dp[i] +        if S[i : i + 6] == "eraser": +            dp[i + 6] |= dp[i] +    if dp[n] == True: