import java.io.PrintWriter;
import java.util.Scanner;

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

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

        PrintWriter out = new PrintWriter(System.out);

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

        sc.close();
        out.flush();
    }
} import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();

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

        PrintWriter out = new PrintWriter(System.out);

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

        sc.close();
        out.flush();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();

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

        PrintWriter out = new PrintWriter(System.out);

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

        sc.close();
        out.flush();
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();

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

        PrintWriter out = new PrintWriter(System.out);

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

        sc.close();
        out.flush();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next 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 "-" "" PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) if (S.length() == 0) {
            out.println("YES");
        } else {
            out.println("NO");
        } S.length() == 0 S.length() S.length S 0 {
            out.println("YES");
        } out.println("YES") out.println out "YES" {
            out.println("NO");
        } out.println("NO") out.println out "NO" sc.close() sc.close sc out.flush() out.flush out String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();

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

        PrintWriter out = new PrintWriter(System.out);

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

        sc.close();
        out.flush();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();

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

        PrintWriter out = new PrintWriter(System.out);

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

        sc.close();
        out.flush();
    }
} Main
import java.io.PrintWriter;
import java.util.Scanner;

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

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

        PrintWriter out = new PrintWriter(System.out);

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

        sc.close();
        out.flush();
    }
}