Problem:


Score : 300 points

Problem Statement

You are given a string S consisting of lowercase English letters.
Another string T is initially empty.
Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:

Append one of the following at the end of T: dream, dreamer, erase and eraser.

Constraints

1≦|S|≦10^5

S consists of lowercase English letters.

Input

The input is given from Standard Input in the following format:

S

Output

If it is possible to obtain S = T, print YES. Otherwise, print NO.

Sample Input 1

erasedream

Sample Output 1

YES

Append erase and dream at the end of T in this order, to obtain S = T.

Sample Input 2

dreameraser

Sample Output 2

YES

Append dream and eraser at the end of T in this order, to obtain S = T.

Sample Input 3

dreamerer

Sample Output 3

NO



Sample input:
erasedream


Sample output:
YES

Submission status: Accepted

Solution code:
import subprocess
import gzip, base64, os
import stat

gz = b'H4sIAPqraV0C/+19e2BUxfX/zXt5JBsQMPKQVRYMIiELARJf3SUs3IUNpAQQtfGy2WxIdJPd7t7F4NcqmsSyhCi1VvH7a6u11drHt+VbW4t+K4aixNrWFxVBKeKTuwQkiEKqwv7OmZm7O/fu3kD49ff75+dVMns+c+bMnDMzZx73MXc63QsyMzIE9coUrhWQ8lxoJ7Sd4cXeBAtg5cIQ+DtRGC/kAp3D8dkFuybsZ6LV0MT4suBfNvwrz6R0eaZdE45nfGqYwYU5An/ZNeH+bwqaUBAsiXRY1r21FN1bu1oTbs2i+NZcbbpMlq6fpetn/GooZAqaUNUvm/1bzvDlTC81nM/45nP8eFV/JNfj7w1uSm9w2zVhO+Nr16X7JqTLFc79KmThMpafkV2KWfnVUK2HGf6mujllM/z10/1NLZHW6a3lc6bPKSsJB0pmkjIVMt6FS1Zo7FjEyjyKtQGMn9Bz6HhTz57jr5Y8FTiZf/XOH1z27rsYN52ly4N/HccKG7MvGZKZIVhJMTBuBvwrg39D79os/cj73Iv3Nsdf2tDhHVPQPuHjTdfbj08/Lt1UYFlbWux80919eEr3qC3DK388PrhtneuWp43scgQyHJkGPy2kxwsTLUV7TTTA38pOL6fDAP+dQb4/MOA356THawzw+7LS4982kH+ZgZyxBvgs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M6KdqjxLUS0h1ATo/yTdMTz+98bF0v9wX01ZQ8ClxbNjLCnN+p2Lo8yUvNKY3jnA+lNupwBkd569h95AmddMd0p1bmv+E46jQuXQdpznmGOHYQs/7g9NROr57InWoPdqZ2GkPpDxzXstBDopM1YytLPbdalwLPjlZ9ypIKMGtLBHse5CPJAamVGs5VEwbzLJeqFzRVg+sAh1czU6oGS0lrPeCZwriKXuNsrpkt3Sb8b7VdPmBWiAAA'
bin = gzip.decompress(base64.b64decode(gz))
p = os.path.dirname(__file__)
pymain = os.path.join(p, "a.out")
with open(pymain, "wb") as f:
    f.write(bin)
os.chmod(pymain, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
if p == "":
    pymain = "./" + pymain
subprocess.call(pymain)


# compiled by pythran
'''
#pythran export main2()

def str2int(s):
    a = []
    for c in s:
        ai = []
        for x in c:
            ai.append(ord(x))
        a.append(ai)
    return a

def endwith(s, i, a):
    l = len(a)
    if i < l:
        return -1
    k = i - l
    for j in range(l):
        if ord(s[k + j]) != a[j]:
            return -1
    return k

def main2():
    strl = ['dream', 'dreamer', 'erase', 'eraser']
    intl = str2int(strl)
    s = open('/dev/stdin').readline()
    j = len(s) - 1
    i = j + 1
    while j < i:
        i = j
        for ai in intl:
            k = endwith(s, i, ai)
            if k > -1:
                j = k
    if j == 0:
        print('YES')
    else:
        print('NO')
'''