Score : 300 points
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:
dream
, dreamer
, erase
and eraser
.The input is given from Standard Input in the following format:
S
If it is possible to obtain S = T, print YES
. Otherwise, print NO
.
erasedream
YES
Append erase
and dream
at the end of T in this order, to obtain S = T.
dreameraser
YES
Append dream
and eraser
at the end of T in this order, to obtain S = T.
dreamerer
NO