import java.util.Scanner;

public class Main {
    static char[] c;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder(sc.next());
        sb.reverse();
        c = sb.toString().toCharArray();
        String str = "";
        boolean ok = true;
        for (int i = 0; i < c.length; i++) {
            if (str.equals("dream") || str.equals("dreamer")
            || str.equals("erase") || str.equals("eraser")) {
                str = "" + c[i];
            } else if (str.length() > 7) {
                ok = false;
                break;
            } else {
                str = c[i] + str;
            }
        }
        if (str.equals("dream") || str.equals("dreamer")
                || str.equals("erase") || str.equals("eraser")) {
        } else {
            ok = false;
        }
        System.out.println(ok?"YES":"NO");
    }
} import java.util.Scanner; Scanner java.util public class Main {
    static char[] c;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder(sc.next());
        sb.reverse();
        c = sb.toString().toCharArray();
        String str = "";
        boolean ok = true;
        for (int i = 0; i < c.length; i++) {
            if (str.equals("dream") || str.equals("dreamer")
            || str.equals("erase") || str.equals("eraser")) {
                str = "" + c[i];
            } else if (str.length() > 7) {
                ok = false;
                break;
            } else {
                str = c[i] + str;
            }
        }
        if (str.equals("dream") || str.equals("dreamer")
                || str.equals("erase") || str.equals("eraser")) {
        } else {
            ok = false;
        }
        System.out.println(ok?"YES":"NO");
    }
} Main static char[] c; c public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder(sc.next());
        sb.reverse();
        c = sb.toString().toCharArray();
        String str = "";
        boolean ok = true;
        for (int i = 0; i < c.length; i++) {
            if (str.equals("dream") || str.equals("dreamer")
            || str.equals("erase") || str.equals("eraser")) {
                str = "" + c[i];
            } else if (str.length() > 7) {
                ok = false;
                break;
            } else {
                str = c[i] + str;
            }
        }
        if (str.equals("dream") || str.equals("dreamer")
                || str.equals("erase") || str.equals("eraser")) {
        } else {
            ok = false;
        }
        System.out.println(ok?"YES":"NO");
    } main {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder(sc.next());
        sb.reverse();
        c = sb.toString().toCharArray();
        String str = "";
        boolean ok = true;
        for (int i = 0; i < c.length; i++) {
            if (str.equals("dream") || str.equals("dreamer")
            || str.equals("erase") || str.equals("eraser")) {
                str = "" + c[i];
            } else if (str.length() > 7) {
                ok = false;
                break;
            } else {
                str = c[i] + str;
            }
        }
        if (str.equals("dream") || str.equals("dreamer")
                || str.equals("erase") || str.equals("eraser")) {
        } else {
            ok = false;
        }
        System.out.println(ok?"YES":"NO");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) StringBuilder sb = new StringBuilder(sc.next()); sb new StringBuilder(sc.next()) sb.reverse() sb.reverse sb c = sb.toString().toCharArray() c sb.toString().toCharArray() sb.toString().toCharArray sb.toString() sb.toString sb String str = ""; str "" boolean ok = true; ok true for (int i = 0; i < c.length; i++) {
            if (str.equals("dream") || str.equals("dreamer")
            || str.equals("erase") || str.equals("eraser")) {
                str = "" + c[i];
            } else if (str.length() > 7) {
                ok = false;
                break;
            } else {
                str = c[i] + str;
            }
        } int i = 0; int i = 0; i 0 i < c.length i c.length c c.length i++ i++ i {
            if (str.equals("dream") || str.equals("dreamer")
            || str.equals("erase") || str.equals("eraser")) {
                str = "" + c[i];
            } else if (str.length() > 7) {
                ok = false;
                break;
            } else {
                str = c[i] + str;
            }
        } {
            if (str.equals("dream") || str.equals("dreamer")
            || str.equals("erase") || str.equals("eraser")) {
                str = "" + c[i];
            } else if (str.length() > 7) {
                ok = false;
                break;
            } else {
                str = c[i] + str;
            }
        } if (str.equals("dream") || str.equals("dreamer")
            || str.equals("erase") || str.equals("eraser")) {
                str = "" + c[i];
            } else if (str.length() > 7) {
                ok = false;
                break;
            } else {
                str = c[i] + str;
            } str.equals("dream") || str.equals("dreamer")
            || str.equals("erase") || str.equals("eraser") str.equals("erase") str.equals("dream") || str.equals("dreamer")
            || str.equals("erase") || str.equals("eraser") str.equals("dream") str.equals str "dream" str.equals("dreamer") str.equals str "dreamer" str.equals("erase") str.equals str "erase" str.equals("eraser") str.equals str "eraser" {
                str = "" + c[i];
            } str = "" + c[i] str "" + c[i] "" c[i] c i if (str.length() > 7) {
                ok = false;
                break;
            } else {
                str = c[i] + str;
            } str.length() > 7 str.length() str.length str 7 {
                ok = false;
                break;
            } ok = false ok false break; {
                str = c[i] + str;
            } str = c[i] + str str c[i] + str c[i] c i str if (str.equals("dream") || str.equals("dreamer")
                || str.equals("erase") || str.equals("eraser")) {
        } else {
            ok = false;
        } str.equals("dream") || str.equals("dreamer")
                || str.equals("erase") || str.equals("eraser") str.equals("erase") str.equals("dream") || str.equals("dreamer")
                || str.equals("erase") || str.equals("eraser") str.equals("dream") str.equals str "dream" str.equals("dreamer") str.equals str "dreamer" str.equals("erase") str.equals str "erase" str.equals("eraser") str.equals str "eraser" {
        } {
            ok = false;
        } ok = false ok false System.out.println(ok?"YES":"NO") System.out.println System.out System System.out ok?"YES":"NO" ok "YES" "NO" String[] args args public class Main {
    static char[] c;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder(sc.next());
        sb.reverse();
        c = sb.toString().toCharArray();
        String str = "";
        boolean ok = true;
        for (int i = 0; i < c.length; i++) {
            if (str.equals("dream") || str.equals("dreamer")
            || str.equals("erase") || str.equals("eraser")) {
                str = "" + c[i];
            } else if (str.length() > 7) {
                ok = false;
                break;
            } else {
                str = c[i] + str;
            }
        }
        if (str.equals("dream") || str.equals("dreamer")
                || str.equals("erase") || str.equals("eraser")) {
        } else {
            ok = false;
        }
        System.out.println(ok?"YES":"NO");
    }
} public class Main {
    static char[] c;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder(sc.next());
        sb.reverse();
        c = sb.toString().toCharArray();
        String str = "";
        boolean ok = true;
        for (int i = 0; i < c.length; i++) {
            if (str.equals("dream") || str.equals("dreamer")
            || str.equals("erase") || str.equals("eraser")) {
                str = "" + c[i];
            } else if (str.length() > 7) {
                ok = false;
                break;
            } else {
                str = c[i] + str;
            }
        }
        if (str.equals("dream") || str.equals("dreamer")
                || str.equals("erase") || str.equals("eraser")) {
        } else {
            ok = false;
        }
        System.out.println(ok?"YES":"NO");
    }
} Main
import java.util.Scanner;

public class Main {
    static char[] c;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder(sc.next());
        sb.reverse();
        c = sb.toString().toCharArray();
        String str = "";
        boolean ok = true;
        for (int i = 0; i < c.length; i++) {
            if (str.equals("dream") || str.equals("dreamer")
            || str.equals("erase") || str.equals("eraser")) {
                str = "" + c[i];
            } else if (str.length() > 7) {
                ok = false;
                break;
            } else {
                str = c[i] + str;
            }
        }
        if (str.equals("dream") || str.equals("dreamer")
                || str.equals("erase") || str.equals("eraser")) {
        } else {
            ok = false;
        }
        System.out.println(ok?"YES":"NO");
    }
}