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`.
s=list(input())
end=0
def search(s,end):
    if len(s)-end>=5 and (s[end:end+5]==["d","r","e","a","m"] or s[end:end+5]==["e","r","a","s","e"] ):
        return(end+5)
    elif len(s)-end>=6 and (s[end:end+6]==list("eraser")):
        return(end+6)
    elif len(s)-end>=7 and (s[end:end+7]==list("dreamer")):
        return(end+7)
    elif len(s)-end==0:
      return(-2)
    else:
        return(-1)
while end>=0:
    end=search(s,end)
if end==-1:
    print("NO")
else:
    print("Yes")
s=list(input())
s=s[::-1]
start=0
def find(s,start):
    if len(s)-start>=5 and (s[start:start+5]==list("maerd") or s[start:start+5]==list("esare")):
        start=start+5
        return(start,0)
    elif len(s)-start>=6 and s[start:start+6]==list("resare"):
        start=start+6
        return(start,0)
    elif len(s)-start>=7 and s[start:start+7]==list("remaerd"):
        start=start+7
        return(start,0)
    elif len(s)-start==0:
        return(start,1)
    else:
        return(start,2)
shori=0
while shori==0:
    (start,shori)=find(s,start)
if shori==1:
    print("YES")
else:
    print("NO")