import java.lang.StringBuffer;
import java.util.Scanner;

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

        while(true) {
            int length = string.length();
            if (length == 0) {
                System.out.println("YES");
                break;
            }
            if (length >= 5 && string.substring(length - 5, length).equals("dream")) {
                string.delete(length - 5, length);
            } else if (length >= 7 && string.substring(length - 7, length).equals("dreamer")) {
                string.delete(length - 7, length);
            } else if (length >= 5 && string.substring(length - 5, length).equals("erase")) {
                string.delete(length - 5, length);
            } else if (length >= 6 && string.substring(length - 6, length).equals("eraser")) {
                string.delete(length - 6, length);
            } else {
                System.out.println("NO");
                break;
            }
        }
    }
} import java.lang.StringBuffer; StringBuffer java.lang import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        StringBuffer string = new StringBuffer(scanner.next());

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

        while(true) {
            int length = string.length();
            if (length == 0) {
                System.out.println("YES");
                break;
            }
            if (length >= 5 && string.substring(length - 5, length).equals("dream")) {
                string.delete(length - 5, length);
            } else if (length >= 7 && string.substring(length - 7, length).equals("dreamer")) {
                string.delete(length - 7, length);
            } else if (length >= 5 && string.substring(length - 5, length).equals("erase")) {
                string.delete(length - 5, length);
            } else if (length >= 6 && string.substring(length - 6, length).equals("eraser")) {
                string.delete(length - 6, length);
            } else {
                System.out.println("NO");
                break;
            }
        }
    } main {
        Scanner scanner = new Scanner(System.in);
        StringBuffer string = new StringBuffer(scanner.next());

        while(true) {
            int length = string.length();
            if (length == 0) {
                System.out.println("YES");
                break;
            }
            if (length >= 5 && string.substring(length - 5, length).equals("dream")) {
                string.delete(length - 5, length);
            } else if (length >= 7 && string.substring(length - 7, length).equals("dreamer")) {
                string.delete(length - 7, length);
            } else if (length >= 5 && string.substring(length - 5, length).equals("erase")) {
                string.delete(length - 5, length);
            } else if (length >= 6 && string.substring(length - 6, length).equals("eraser")) {
                string.delete(length - 6, length);
            } else {
                System.out.println("NO");
                break;
            }
        }
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) StringBuffer string = new StringBuffer(scanner.next()); string new StringBuffer(scanner.next()) while(true) {
            int length = string.length();
            if (length == 0) {
                System.out.println("YES");
                break;
            }
            if (length >= 5 && string.substring(length - 5, length).equals("dream")) {
                string.delete(length - 5, length);
            } else if (length >= 7 && string.substring(length - 7, length).equals("dreamer")) {
                string.delete(length - 7, length);
            } else if (length >= 5 && string.substring(length - 5, length).equals("erase")) {
                string.delete(length - 5, length);
            } else if (length >= 6 && string.substring(length - 6, length).equals("eraser")) {
                string.delete(length - 6, length);
            } else {
                System.out.println("NO");
                break;
            }
        } true {
            int length = string.length();
            if (length == 0) {
                System.out.println("YES");
                break;
            }
            if (length >= 5 && string.substring(length - 5, length).equals("dream")) {
                string.delete(length - 5, length);
            } else if (length >= 7 && string.substring(length - 7, length).equals("dreamer")) {
                string.delete(length - 7, length);
            } else if (length >= 5 && string.substring(length - 5, length).equals("erase")) {
                string.delete(length - 5, length);
            } else if (length >= 6 && string.substring(length - 6, length).equals("eraser")) {
                string.delete(length - 6, length);
            } else {
                System.out.println("NO");
                break;
            }
        } int length = string.length(); length string.length() string.length string if (length == 0) {
                System.out.println("YES");
                break;
            } length == 0 length 0 {
                System.out.println("YES");
                break;
            } System.out.println("YES") System.out.println System.out System System.out "YES" break; if (length >= 5 && string.substring(length - 5, length).equals("dream")) {
                string.delete(length - 5, length);
            } else if (length >= 7 && string.substring(length - 7, length).equals("dreamer")) {
                string.delete(length - 7, length);
            } else if (length >= 5 && string.substring(length - 5, length).equals("erase")) {
                string.delete(length - 5, length);
            } else if (length >= 6 && string.substring(length - 6, length).equals("eraser")) {
                string.delete(length - 6, length);
            } else {
                System.out.println("NO");
                break;
            } length >= 5 && string.substring(length - 5, length).equals("dream") length >= 5 length 5 string.substring(length - 5, length).equals("dream") string.substring(length - 5, length).equals string.substring(length - 5, length) string.substring string length - 5 length 5 length "dream" {
                string.delete(length - 5, length);
            } string.delete(length - 5, length) string.delete string length - 5 length 5 length if (length >= 7 && string.substring(length - 7, length).equals("dreamer")) {
                string.delete(length - 7, length);
            } else if (length >= 5 && string.substring(length - 5, length).equals("erase")) {
                string.delete(length - 5, length);
            } else if (length >= 6 && string.substring(length - 6, length).equals("eraser")) {
                string.delete(length - 6, length);
            } else {
                System.out.println("NO");
                break;
            } length >= 7 && string.substring(length - 7, length).equals("dreamer") length >= 7 length 7 string.substring(length - 7, length).equals("dreamer") string.substring(length - 7, length).equals string.substring(length - 7, length) string.substring string length - 7 length 7 length "dreamer" {
                string.delete(length - 7, length);
            } string.delete(length - 7, length) string.delete string length - 7 length 7 length if (length >= 5 && string.substring(length - 5, length).equals("erase")) {
                string.delete(length - 5, length);
            } else if (length >= 6 && string.substring(length - 6, length).equals("eraser")) {
                string.delete(length - 6, length);
            } else {
                System.out.println("NO");
                break;
            } length >= 5 && string.substring(length - 5, length).equals("erase") length >= 5 length 5 string.substring(length - 5, length).equals("erase") string.substring(length - 5, length).equals string.substring(length - 5, length) string.substring string length - 5 length 5 length "erase" {
                string.delete(length - 5, length);
            } string.delete(length - 5, length) string.delete string length - 5 length 5 length if (length >= 6 && string.substring(length - 6, length).equals("eraser")) {
                string.delete(length - 6, length);
            } else {
                System.out.println("NO");
                break;
            } length >= 6 && string.substring(length - 6, length).equals("eraser") length >= 6 length 6 string.substring(length - 6, length).equals("eraser") string.substring(length - 6, length).equals string.substring(length - 6, length) string.substring string length - 6 length 6 length "eraser" {
                string.delete(length - 6, length);
            } string.delete(length - 6, length) string.delete string length - 6 length 6 length {
                System.out.println("NO");
                break;
            } System.out.println("NO") System.out.println System.out System System.out "NO" break; String[] args args
import java.lang.StringBuffer;
import java.util.Scanner;

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

        while(true) {
            int length = string.length();
            if (length == 0) {
                System.out.println("YES");
                break;
            }
            if (length >= 5 && string.substring(length - 5, length).equals("dream")) {
                string.delete(length - 5, length);
            } else if (length >= 7 && string.substring(length - 7, length).equals("dreamer")) {
                string.delete(length - 7, length);
            } else if (length >= 5 && string.substring(length - 5, length).equals("erase")) {
                string.delete(length - 5, length);
            } else if (length >= 6 && string.substring(length - 6, length).equals("eraser")) {
                string.delete(length - 6, length);
            } else {
                System.out.println("NO");
                break;
            }
        }
    }
}
