import java.util.Scanner;

public class Main {

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

        String[] match = { "dream", "dreamer", "erase", "eraser" };

        boolean next = true;
        int length = N.length();
        while (next && length > 0) {
            next = false;
            for (int i = 0; i < match.length; i++) {
                int lastIndex = N.lastIndexOf(match[i]);
                if (lastIndex>=0 && lastIndex + match[i].length() == length) {
                    N.setLength(length - match[i].length());
                    next = true;
                    length = N.length();
                    break;
                }
            }
        }
        if (next) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {

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

        String[] match = { "dream", "dreamer", "erase", "eraser" };

        boolean next = true;
        int length = N.length();
        while (next && length > 0) {
            next = false;
            for (int i = 0; i < match.length; i++) {
                int lastIndex = N.lastIndexOf(match[i]);
                if (lastIndex>=0 && lastIndex + match[i].length() == length) {
                    N.setLength(length - match[i].length());
                    next = true;
                    length = N.length();
                    break;
                }
            }
        }
        if (next) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder N = new StringBuilder(sc.nextLine());
        sc.close();

        String[] match = { "dream", "dreamer", "erase", "eraser" };

        boolean next = true;
        int length = N.length();
        while (next && length > 0) {
            next = false;
            for (int i = 0; i < match.length; i++) {
                int lastIndex = N.lastIndexOf(match[i]);
                if (lastIndex>=0 && lastIndex + match[i].length() == length) {
                    N.setLength(length - match[i].length());
                    next = true;
                    length = N.length();
                    break;
                }
            }
        }
        if (next) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        StringBuilder N = new StringBuilder(sc.nextLine());
        sc.close();

        String[] match = { "dream", "dreamer", "erase", "eraser" };

        boolean next = true;
        int length = N.length();
        while (next && length > 0) {
            next = false;
            for (int i = 0; i < match.length; i++) {
                int lastIndex = N.lastIndexOf(match[i]);
                if (lastIndex>=0 && lastIndex + match[i].length() == length) {
                    N.setLength(length - match[i].length());
                    next = true;
                    length = N.length();
                    break;
                }
            }
        }
        if (next) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) StringBuilder N = new StringBuilder(sc.nextLine()); N new StringBuilder(sc.nextLine()) sc.close() sc.close sc String[] match = { "dream", "dreamer", "erase", "eraser" }; match { "dream", "dreamer", "erase", "eraser" } "dream" "dreamer" "erase" "eraser" boolean next = true; next true int length = N.length(); length N.length() N.length N while (next && length > 0) {
            next = false;
            for (int i = 0; i < match.length; i++) {
                int lastIndex = N.lastIndexOf(match[i]);
                if (lastIndex>=0 && lastIndex + match[i].length() == length) {
                    N.setLength(length - match[i].length());
                    next = true;
                    length = N.length();
                    break;
                }
            }
        } next && length > 0 next length > 0 length 0 {
            next = false;
            for (int i = 0; i < match.length; i++) {
                int lastIndex = N.lastIndexOf(match[i]);
                if (lastIndex>=0 && lastIndex + match[i].length() == length) {
                    N.setLength(length - match[i].length());
                    next = true;
                    length = N.length();
                    break;
                }
            }
        } next = false next false for (int i = 0; i < match.length; i++) {
                int lastIndex = N.lastIndexOf(match[i]);
                if (lastIndex>=0 && lastIndex + match[i].length() == length) {
                    N.setLength(length - match[i].length());
                    next = true;
                    length = N.length();
                    break;
                }
            } int i = 0; int i = 0; i 0 i < match.length i match.length match match.length i++ i++ i {
                int lastIndex = N.lastIndexOf(match[i]);
                if (lastIndex>=0 && lastIndex + match[i].length() == length) {
                    N.setLength(length - match[i].length());
                    next = true;
                    length = N.length();
                    break;
                }
            } {
                int lastIndex = N.lastIndexOf(match[i]);
                if (lastIndex>=0 && lastIndex + match[i].length() == length) {
                    N.setLength(length - match[i].length());
                    next = true;
                    length = N.length();
                    break;
                }
            } int lastIndex = N.lastIndexOf(match[i]); lastIndex N.lastIndexOf(match[i]) N.lastIndexOf N match[i] match i if (lastIndex>=0 && lastIndex + match[i].length() == length) {
                    N.setLength(length - match[i].length());
                    next = true;
                    length = N.length();
                    break;
                } lastIndex>=0 && lastIndex + match[i].length() == length lastIndex>=0 lastIndex 0 lastIndex + match[i].length() == length lastIndex + match[i].length() lastIndex match[i].length() match[i].length match[i] match i length {
                    N.setLength(length - match[i].length());
                    next = true;
                    length = N.length();
                    break;
                } N.setLength(length - match[i].length()) N.setLength N length - match[i].length() length match[i].length() match[i].length match[i] match i next = true next true length = N.length() length N.length() N.length N break; if (next) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        } next {
            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);
        StringBuilder N = new StringBuilder(sc.nextLine());
        sc.close();

        String[] match = { "dream", "dreamer", "erase", "eraser" };

        boolean next = true;
        int length = N.length();
        while (next && length > 0) {
            next = false;
            for (int i = 0; i < match.length; i++) {
                int lastIndex = N.lastIndexOf(match[i]);
                if (lastIndex>=0 && lastIndex + match[i].length() == length) {
                    N.setLength(length - match[i].length());
                    next = true;
                    length = N.length();
                    break;
                }
            }
        }
        if (next) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} public class Main {

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

        String[] match = { "dream", "dreamer", "erase", "eraser" };

        boolean next = true;
        int length = N.length();
        while (next && length > 0) {
            next = false;
            for (int i = 0; i < match.length; i++) {
                int lastIndex = N.lastIndexOf(match[i]);
                if (lastIndex>=0 && lastIndex + match[i].length() == length) {
                    N.setLength(length - match[i].length());
                    next = true;
                    length = N.length();
                    break;
                }
            }
        }
        if (next) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} Main
import java.util.Scanner;

public class Main {

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

        String[] match = { "dream", "dreamer", "erase", "eraser" };

        boolean next = true;
        int length = N.length();
        while (next && length > 0) {
            next = false;
            for (int i = 0; i < match.length; i++) {
                int lastIndex = N.lastIndexOf(match[i]);
                if (lastIndex>=0 && lastIndex + match[i].length() == length) {
                    N.setLength(length - match[i].length());
                    next = true;
                    length = N.length();
                    break;
                }
            }
        }
        if (next) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}