S = input()

e = len(S)
while e > 0:
    if S[e - 5 : e] == "dream":
        e -= 5
    elif S[e - 7 : e] == "dreamer":
        e -= 7
    elif S[e - 5 : e] == "erase":
        e -= 5
    elif S[e - 6 : e] == "eraser":
        e -= 6
    else:
        break

print("YES" if e == 0 else "NO")
