
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.nextLine();

        s = s.replaceAll("eraser",  "-");
        s = s.replaceAll("erase",   "-");
        s = s.replaceAll("dreamer", "-");
        s = s.replaceAll("dream",   "-");
        s = s.replaceAll("-", "");

        if (s.length() == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} import java.util.*; util.* java public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.nextLine();

        s = s.replaceAll("eraser",  "-");
        s = s.replaceAll("erase",   "-");
        s = s.replaceAll("dreamer", "-");
        s = s.replaceAll("dream",   "-");
        s = s.replaceAll("-", "");

        if (s.length() == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.nextLine();

        s = s.replaceAll("eraser",  "-");
        s = s.replaceAll("erase",   "-");
        s = s.replaceAll("dreamer", "-");
        s = s.replaceAll("dream",   "-");
        s = s.replaceAll("-", "");

        if (s.length() == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    } main {
        Scanner sc = new Scanner(System.in);

        String s = sc.nextLine();

        s = s.replaceAll("eraser",  "-");
        s = s.replaceAll("erase",   "-");
        s = s.replaceAll("dreamer", "-");
        s = s.replaceAll("dream",   "-");
        s = s.replaceAll("-", "");

        if (s.length() == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc s = s.replaceAll("eraser",  "-") s s.replaceAll("eraser",  "-") s.replaceAll s "eraser" "-" s = s.replaceAll("erase",   "-") s s.replaceAll("erase",   "-") s.replaceAll s "erase" "-" s = s.replaceAll("dreamer", "-") s s.replaceAll("dreamer", "-") s.replaceAll s "dreamer" "-" s = s.replaceAll("dream",   "-") s s.replaceAll("dream",   "-") s.replaceAll s "dream" "-" s = s.replaceAll("-", "") s s.replaceAll("-", "") s.replaceAll s "-" "" if (s.length() == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        } s.length() == 0 s.length() s.length s 0 {
            System.out.println("YES");
        } System.out.println("YES") System.out.println System.out System System.out "YES" {
            System.out.println("NO");
        } System.out.println("NO") System.out.println System.out System System.out "NO" String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.nextLine();

        s = s.replaceAll("eraser",  "-");
        s = s.replaceAll("erase",   "-");
        s = s.replaceAll("dreamer", "-");
        s = s.replaceAll("dream",   "-");
        s = s.replaceAll("-", "");

        if (s.length() == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.nextLine();

        s = s.replaceAll("eraser",  "-");
        s = s.replaceAll("erase",   "-");
        s = s.replaceAll("dreamer", "-");
        s = s.replaceAll("dream",   "-");
        s = s.replaceAll("-", "");

        if (s.length() == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} Main

import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.nextLine();

        s = s.replaceAll("eraser",  "-");
        s = s.replaceAll("erase",   "-");
        s = s.replaceAll("dreamer", "-");
        s = s.replaceAll("dream",   "-");
        s = s.replaceAll("-", "");

        if (s.length() == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}
