import java.util.*;

class Main{
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]){
        String S=sc.next();
        int i=0;
        for(i=S.length();i>4;i--){
            String s5=S.substring(i-5,i);
            if(s5.equals("dream")||s5.equals("erase")){
                i-=4;
                continue;
            }
            String s6=S.substring(i-6,i);
            if(s6.equals("eraser")){
                i-=5;
                continue;
            }
            String s7=S.substring(i-7,i);
            if(s7.equals("dreamer")){
                i-=6;
                continue;
            }
            break;
        }
        System.out.println(i==0?"YES":"NO");
    }
} import java.util.*; util.* java class Main{
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]){
        String S=sc.next();
        int i=0;
        for(i=S.length();i>4;i--){
            String s5=S.substring(i-5,i);
            if(s5.equals("dream")||s5.equals("erase")){
                i-=4;
                continue;
            }
            String s6=S.substring(i-6,i);
            if(s6.equals("eraser")){
                i-=5;
                continue;
            }
            String s7=S.substring(i-7,i);
            if(s7.equals("dreamer")){
                i-=6;
                continue;
            }
            break;
        }
        System.out.println(i==0?"YES":"NO");
    }
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String args[]){
        String S=sc.next();
        int i=0;
        for(i=S.length();i>4;i--){
            String s5=S.substring(i-5,i);
            if(s5.equals("dream")||s5.equals("erase")){
                i-=4;
                continue;
            }
            String s6=S.substring(i-6,i);
            if(s6.equals("eraser")){
                i-=5;
                continue;
            }
            String s7=S.substring(i-7,i);
            if(s7.equals("dreamer")){
                i-=6;
                continue;
            }
            break;
        }
        System.out.println(i==0?"YES":"NO");
    } main {
        String S=sc.next();
        int i=0;
        for(i=S.length();i>4;i--){
            String s5=S.substring(i-5,i);
            if(s5.equals("dream")||s5.equals("erase")){
                i-=4;
                continue;
            }
            String s6=S.substring(i-6,i);
            if(s6.equals("eraser")){
                i-=5;
                continue;
            }
            String s7=S.substring(i-7,i);
            if(s7.equals("dreamer")){
                i-=6;
                continue;
            }
            break;
        }
        System.out.println(i==0?"YES":"NO");
    } String S=sc.next(); S sc.next() sc.next sc int i=0; i 0 for(i=S.length();i>4;i--){
            String s5=S.substring(i-5,i);
            if(s5.equals("dream")||s5.equals("erase")){
                i-=4;
                continue;
            }
            String s6=S.substring(i-6,i);
            if(s6.equals("eraser")){
                i-=5;
                continue;
            }
            String s7=S.substring(i-7,i);
            if(s7.equals("dreamer")){
                i-=6;
                continue;
            }
            break;
        } i=S.length(); i=S.length() i S.length() S.length S i>4 i 4 i-- i-- i {
            String s5=S.substring(i-5,i);
            if(s5.equals("dream")||s5.equals("erase")){
                i-=4;
                continue;
            }
            String s6=S.substring(i-6,i);
            if(s6.equals("eraser")){
                i-=5;
                continue;
            }
            String s7=S.substring(i-7,i);
            if(s7.equals("dreamer")){
                i-=6;
                continue;
            }
            break;
        } {
            String s5=S.substring(i-5,i);
            if(s5.equals("dream")||s5.equals("erase")){
                i-=4;
                continue;
            }
            String s6=S.substring(i-6,i);
            if(s6.equals("eraser")){
                i-=5;
                continue;
            }
            String s7=S.substring(i-7,i);
            if(s7.equals("dreamer")){
                i-=6;
                continue;
            }
            break;
        } String s5=S.substring(i-5,i); s5 S.substring(i-5,i) S.substring S i-5 i 5 i if(s5.equals("dream")||s5.equals("erase")){
                i-=4;
                continue;
            } s5.equals("dream")||s5.equals("erase") s5.equals("dream") s5.equals s5 "dream" s5.equals("erase") s5.equals s5 "erase" {
                i-=4;
                continue;
            } i-=4 i 4 continue; String s6=S.substring(i-6,i); s6 S.substring(i-6,i) S.substring S i-6 i 6 i if(s6.equals("eraser")){
                i-=5;
                continue;
            } s6.equals("eraser") s6.equals s6 "eraser" {
                i-=5;
                continue;
            } i-=5 i 5 continue; String s7=S.substring(i-7,i); s7 S.substring(i-7,i) S.substring S i-7 i 7 i if(s7.equals("dreamer")){
                i-=6;
                continue;
            } s7.equals("dreamer") s7.equals s7 "dreamer" {
                i-=6;
                continue;
            } i-=6 i 6 continue; break; System.out.println(i==0?"YES":"NO") System.out.println System.out System System.out i==0?"YES":"NO" i==0 i 0 "YES" "NO" String args[] args
import java.util.*;

class Main{
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]){
        String S=sc.next();
        int i=0;
        for(i=S.length();i>4;i--){
            String s5=S.substring(i-5,i);
            if(s5.equals("dream")||s5.equals("erase")){
                i-=4;
                continue;
            }
            String s6=S.substring(i-6,i);
            if(s6.equals("eraser")){
                i-=5;
                continue;
            }
            String s7=S.substring(i-7,i);
            if(s7.equals("dreamer")){
                i-=6;
                continue;
            }
            break;
        }
        System.out.println(i==0?"YES":"NO");
    }
}