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`.
def main():
    Ss = input()
    S = list(Ss)
    now = 0
    T = ''
    while True:
        tmp5 = S[now:now+5]
        if tmp5[0] == 'd':
            tmp = S[now:now+7]
        elif tmp5[0] == 'e':
            tmp = S[now:now+6]
        if tmp5 == ['d','r','e','a','m'] and tmp == ['d','r','e','a','m','e','r']:
            if now+7 < len(S) and S[now+7] == 'e':
                T += 'dreamer'
                now += 7
            else:
                T += 'dream'
                now += 5
        elif tmp5 == ['e','r','a','s','e'] and tmp == ['e','r','a','s','e','r']:
            if now+6 == len(S)  or (now+6 < len(S) and S[now+6] == 'e'):
                T += 'eraser'
                now += 6
            else:
                T += 'erase'
                now += 5
        elif tmp5 == ['d','r','e','a','m']:
            T += 'dream'
            now += 5
        elif tmp5 == ['e','r','a','s','e']:
            T += 'erase'
            now += 5
        else:
            print('No')
            return
        if now >= len(S):
            break
    if Ss == T:
        print('Yes')

if __name__ == '__main__':
    main()

    
def main():
    Ss = input()
    S = list(Ss)
    now = 0
    T = ''
    Sr = []
    for i in range(1,len(S)+1):
        Sr.append(S[-i])
    ans = []
    while True:
        tmp5 = Sr[now:now+5]
        tmp6 = Sr[now:now+6]
        tmp7 = Sr[now:now+7]
        if tmp5[0] == 'e' and tmp5 == ['e','s','a','r','e']:
            ans.append('erase')
            now += 5
        elif tmp5[0] == 'm' and tmp5 == ['m','a','e','r','d']:
            ans.append('dream')
            now += 5
        elif tmp6[0] == 'r' and tmp6 == ['r','e','s','a','r','e']:
            ans.append('eraser')
            now += 6
        elif tmp7[0] == 'r' and tmp7 == ['r','e','m','a','e','r','d']:
            ans.append('dreamer')
            now += 7
        else:
            print('NO')
            
            return

        if now >= len(S):
            break
    for i in range(1,len(ans)+1):
        T += ans[-i]
    if Ss == T:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    main()
