import java.util.*;

public class Main{
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args){
        String s = sc.next();
        int tail = s.length();
        String ans = "NO";
        while(tail > 0){
            if(tail >= 5 && s.substring(tail - 5, tail).equals("dream")){
                tail -= 5;
            }else if(tail >= 7 && s.substring(tail - 7, tail).equals("dreamer")){
                tail -= 7;
            }else if(tail >= 5 && s.substring(tail - 5, tail).equals("erase")){
                tail -= 5;
            }else if(tail >= 6 && s.substring(tail - 6, tail).equals("eraser")){
                tail -= 6;
            }else{
                System.out.println("NO");
                return;
            }
        }

        if(tail == 0) ans = "YES";
        System.out.println(ans);
    }
} import java.util.*; util.* java public class Main{
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args){
        String s = sc.next();
        int tail = s.length();
        String ans = "NO";
        while(tail > 0){
            if(tail >= 5 && s.substring(tail - 5, tail).equals("dream")){
                tail -= 5;
            }else if(tail >= 7 && s.substring(tail - 7, tail).equals("dreamer")){
                tail -= 7;
            }else if(tail >= 5 && s.substring(tail - 5, tail).equals("erase")){
                tail -= 5;
            }else if(tail >= 6 && s.substring(tail - 6, tail).equals("eraser")){
                tail -= 6;
            }else{
                System.out.println("NO");
                return;
            }
        }

        if(tail == 0) ans = "YES";
        System.out.println(ans);
    }
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args){
        String s = sc.next();
        int tail = s.length();
        String ans = "NO";
        while(tail > 0){
            if(tail >= 5 && s.substring(tail - 5, tail).equals("dream")){
                tail -= 5;
            }else if(tail >= 7 && s.substring(tail - 7, tail).equals("dreamer")){
                tail -= 7;
            }else if(tail >= 5 && s.substring(tail - 5, tail).equals("erase")){
                tail -= 5;
            }else if(tail >= 6 && s.substring(tail - 6, tail).equals("eraser")){
                tail -= 6;
            }else{
                System.out.println("NO");
                return;
            }
        }

        if(tail == 0) ans = "YES";
        System.out.println(ans);
    } main {
        String s = sc.next();
        int tail = s.length();
        String ans = "NO";
        while(tail > 0){
            if(tail >= 5 && s.substring(tail - 5, tail).equals("dream")){
                tail -= 5;
            }else if(tail >= 7 && s.substring(tail - 7, tail).equals("dreamer")){
                tail -= 7;
            }else if(tail >= 5 && s.substring(tail - 5, tail).equals("erase")){
                tail -= 5;
            }else if(tail >= 6 && s.substring(tail - 6, tail).equals("eraser")){
                tail -= 6;
            }else{
                System.out.println("NO");
                return;
            }
        }

        if(tail == 0) ans = "YES";
        System.out.println(ans);
    } String s = sc.next(); s sc.next() sc.next sc int tail = s.length(); tail s.length() s.length s String ans = "NO"; ans "NO" while(tail > 0){
            if(tail >= 5 && s.substring(tail - 5, tail).equals("dream")){
                tail -= 5;
            }else if(tail >= 7 && s.substring(tail - 7, tail).equals("dreamer")){
                tail -= 7;
            }else if(tail >= 5 && s.substring(tail - 5, tail).equals("erase")){
                tail -= 5;
            }else if(tail >= 6 && s.substring(tail - 6, tail).equals("eraser")){
                tail -= 6;
            }else{
                System.out.println("NO");
                return;
            }
        } tail > 0 tail 0 {
            if(tail >= 5 && s.substring(tail - 5, tail).equals("dream")){
                tail -= 5;
            }else if(tail >= 7 && s.substring(tail - 7, tail).equals("dreamer")){
                tail -= 7;
            }else if(tail >= 5 && s.substring(tail - 5, tail).equals("erase")){
                tail -= 5;
            }else if(tail >= 6 && s.substring(tail - 6, tail).equals("eraser")){
                tail -= 6;
            }else{
                System.out.println("NO");
                return;
            }
        } if(tail >= 5 && s.substring(tail - 5, tail).equals("dream")){
                tail -= 5;
            }else if(tail >= 7 && s.substring(tail - 7, tail).equals("dreamer")){
                tail -= 7;
            }else if(tail >= 5 && s.substring(tail - 5, tail).equals("erase")){
                tail -= 5;
            }else if(tail >= 6 && s.substring(tail - 6, tail).equals("eraser")){
                tail -= 6;
            }else{
                System.out.println("NO");
                return;
            } tail >= 5 && s.substring(tail - 5, tail).equals("dream") tail >= 5 tail 5 s.substring(tail - 5, tail).equals("dream") s.substring(tail - 5, tail).equals s.substring(tail - 5, tail) s.substring s tail - 5 tail 5 tail "dream" {
                tail -= 5;
            } tail -= 5 tail 5 if(tail >= 7 && s.substring(tail - 7, tail).equals("dreamer")){
                tail -= 7;
            }else if(tail >= 5 && s.substring(tail - 5, tail).equals("erase")){
                tail -= 5;
            }else if(tail >= 6 && s.substring(tail - 6, tail).equals("eraser")){
                tail -= 6;
            }else{
                System.out.println("NO");
                return;
            } tail >= 7 && s.substring(tail - 7, tail).equals("dreamer") tail >= 7 tail 7 s.substring(tail - 7, tail).equals("dreamer") s.substring(tail - 7, tail).equals s.substring(tail - 7, tail) s.substring s tail - 7 tail 7 tail "dreamer" {
                tail -= 7;
            } tail -= 7 tail 7 if(tail >= 5 && s.substring(tail - 5, tail).equals("erase")){
                tail -= 5;
            }else if(tail >= 6 && s.substring(tail - 6, tail).equals("eraser")){
                tail -= 6;
            }else{
                System.out.println("NO");
                return;
            } tail >= 5 && s.substring(tail - 5, tail).equals("erase") tail >= 5 tail 5 s.substring(tail - 5, tail).equals("erase") s.substring(tail - 5, tail).equals s.substring(tail - 5, tail) s.substring s tail - 5 tail 5 tail "erase" {
                tail -= 5;
            } tail -= 5 tail 5 if(tail >= 6 && s.substring(tail - 6, tail).equals("eraser")){
                tail -= 6;
            }else{
                System.out.println("NO");
                return;
            } tail >= 6 && s.substring(tail - 6, tail).equals("eraser") tail >= 6 tail 6 s.substring(tail - 6, tail).equals("eraser") s.substring(tail - 6, tail).equals s.substring(tail - 6, tail) s.substring s tail - 6 tail 6 tail "eraser" {
                tail -= 6;
            } tail -= 6 tail 6 {
                System.out.println("NO");
                return;
            } System.out.println("NO") System.out.println System.out System System.out "NO" return; if(tail == 0) ans = "YES"; tail == 0 tail 0 ans = "YES" ans "YES" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args){
        String s = sc.next();
        int tail = s.length();
        String ans = "NO";
        while(tail > 0){
            if(tail >= 5 && s.substring(tail - 5, tail).equals("dream")){
                tail -= 5;
            }else if(tail >= 7 && s.substring(tail - 7, tail).equals("dreamer")){
                tail -= 7;
            }else if(tail >= 5 && s.substring(tail - 5, tail).equals("erase")){
                tail -= 5;
            }else if(tail >= 6 && s.substring(tail - 6, tail).equals("eraser")){
                tail -= 6;
            }else{
                System.out.println("NO");
                return;
            }
        }

        if(tail == 0) ans = "YES";
        System.out.println(ans);
    }
} public class Main{
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args){
        String s = sc.next();
        int tail = s.length();
        String ans = "NO";
        while(tail > 0){
            if(tail >= 5 && s.substring(tail - 5, tail).equals("dream")){
                tail -= 5;
            }else if(tail >= 7 && s.substring(tail - 7, tail).equals("dreamer")){
                tail -= 7;
            }else if(tail >= 5 && s.substring(tail - 5, tail).equals("erase")){
                tail -= 5;
            }else if(tail >= 6 && s.substring(tail - 6, tail).equals("eraser")){
                tail -= 6;
            }else{
                System.out.println("NO");
                return;
            }
        }

        if(tail == 0) ans = "YES";
        System.out.println(ans);
    }
} Main
import java.util.*;

public class Main{
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args){
        String s = sc.next();
        int tail = s.length();
        String ans = "NO";
        while(tail > 0){
            if(tail >= 5 && s.substring(tail - 5, tail).equals("dream")){
                tail -= 5;
            }else if(tail >= 7 && s.substring(tail - 7, tail).equals("dreamer")){
                tail -= 7;
            }else if(tail >= 5 && s.substring(tail - 5, tail).equals("erase")){
                tail -= 5;
            }else if(tail >= 6 && s.substring(tail - 6, tail).equals("eraser")){
                tail -= 6;
            }else{
                System.out.println("NO");
                return;
            }
        }

        if(tail == 0) ans = "YES";
        System.out.println(ans);
    }
}