import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        String[] strings = new String[]{
            "dream",
            "dreamer",
            "erase",
            "eraser"
        };

        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        int allLength = S.length();
        int strLength = 0;
        while (true) {
            for (int i = 0; i < strings.length; i++) {
                int restLength = allLength - strings[i].length();
                if (restLength < 0) {
                    continue;
                }
                if ((S.substring(restLength, allLength)).equals(strings[i])) {
                    strLength = strings[i].length();
                    break;
                }
            }
            if (strLength == 0) {
                System.out.println("NO");
                System.exit(0);
            }
            allLength -= strLength;
            if (allLength == 0) {
                System.out.println("YES");
                System.exit(0);
            }
            strLength = 0;
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        String[] strings = new String[]{
            "dream",
            "dreamer",
            "erase",
            "eraser"
        };

        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        int allLength = S.length();
        int strLength = 0;
        while (true) {
            for (int i = 0; i < strings.length; i++) {
                int restLength = allLength - strings[i].length();
                if (restLength < 0) {
                    continue;
                }
                if ((S.substring(restLength, allLength)).equals(strings[i])) {
                    strLength = strings[i].length();
                    break;
                }
            }
            if (strLength == 0) {
                System.out.println("NO");
                System.exit(0);
            }
            allLength -= strLength;
            if (allLength == 0) {
                System.out.println("YES");
                System.exit(0);
            }
            strLength = 0;
        }
    }
} Main public static void main(String[] args) {
        String[] strings = new String[]{
            "dream",
            "dreamer",
            "erase",
            "eraser"
        };

        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        int allLength = S.length();
        int strLength = 0;
        while (true) {
            for (int i = 0; i < strings.length; i++) {
                int restLength = allLength - strings[i].length();
                if (restLength < 0) {
                    continue;
                }
                if ((S.substring(restLength, allLength)).equals(strings[i])) {
                    strLength = strings[i].length();
                    break;
                }
            }
            if (strLength == 0) {
                System.out.println("NO");
                System.exit(0);
            }
            allLength -= strLength;
            if (allLength == 0) {
                System.out.println("YES");
                System.exit(0);
            }
            strLength = 0;
        }
    } main {
        String[] strings = new String[]{
            "dream",
            "dreamer",
            "erase",
            "eraser"
        };

        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        int allLength = S.length();
        int strLength = 0;
        while (true) {
            for (int i = 0; i < strings.length; i++) {
                int restLength = allLength - strings[i].length();
                if (restLength < 0) {
                    continue;
                }
                if ((S.substring(restLength, allLength)).equals(strings[i])) {
                    strLength = strings[i].length();
                    break;
                }
            }
            if (strLength == 0) {
                System.out.println("NO");
                System.exit(0);
            }
            allLength -= strLength;
            if (allLength == 0) {
                System.out.println("YES");
                System.exit(0);
            }
            strLength = 0;
        }
    } String[] strings = new String[]{
            "dream",
            "dreamer",
            "erase",
            "eraser"
        }; strings new String[]{
            "dream",
            "dreamer",
            "erase",
            "eraser"
        } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc int allLength = S.length(); allLength S.length() S.length S int strLength = 0; strLength 0 while (true) {
            for (int i = 0; i < strings.length; i++) {
                int restLength = allLength - strings[i].length();
                if (restLength < 0) {
                    continue;
                }
                if ((S.substring(restLength, allLength)).equals(strings[i])) {
                    strLength = strings[i].length();
                    break;
                }
            }
            if (strLength == 0) {
                System.out.println("NO");
                System.exit(0);
            }
            allLength -= strLength;
            if (allLength == 0) {
                System.out.println("YES");
                System.exit(0);
            }
            strLength = 0;
        } true {
            for (int i = 0; i < strings.length; i++) {
                int restLength = allLength - strings[i].length();
                if (restLength < 0) {
                    continue;
                }
                if ((S.substring(restLength, allLength)).equals(strings[i])) {
                    strLength = strings[i].length();
                    break;
                }
            }
            if (strLength == 0) {
                System.out.println("NO");
                System.exit(0);
            }
            allLength -= strLength;
            if (allLength == 0) {
                System.out.println("YES");
                System.exit(0);
            }
            strLength = 0;
        } for (int i = 0; i < strings.length; i++) {
                int restLength = allLength - strings[i].length();
                if (restLength < 0) {
                    continue;
                }
                if ((S.substring(restLength, allLength)).equals(strings[i])) {
                    strLength = strings[i].length();
                    break;
                }
            } int i = 0; int i = 0; i 0 i < strings.length i strings.length strings strings.length i++ i++ i {
                int restLength = allLength - strings[i].length();
                if (restLength < 0) {
                    continue;
                }
                if ((S.substring(restLength, allLength)).equals(strings[i])) {
                    strLength = strings[i].length();
                    break;
                }
            } {
                int restLength = allLength - strings[i].length();
                if (restLength < 0) {
                    continue;
                }
                if ((S.substring(restLength, allLength)).equals(strings[i])) {
                    strLength = strings[i].length();
                    break;
                }
            } int restLength = allLength - strings[i].length(); restLength allLength - strings[i].length() allLength strings[i].length() strings[i].length strings[i] strings i if (restLength < 0) {
                    continue;
                } restLength < 0 restLength 0 {
                    continue;
                } continue; if ((S.substring(restLength, allLength)).equals(strings[i])) {
                    strLength = strings[i].length();
                    break;
                } (S.substring(restLength, allLength)).equals(strings[i]) (S.substring(restLength, allLength)).equals (S.substring(restLength, allLength)) S.substring S restLength allLength strings[i] strings i {
                    strLength = strings[i].length();
                    break;
                } strLength = strings[i].length() strLength strings[i].length() strings[i].length strings[i] strings i break; if (strLength == 0) {
                System.out.println("NO");
                System.exit(0);
            } strLength == 0 strLength 0 {
                System.out.println("NO");
                System.exit(0);
            } System.out.println("NO") System.out.println System.out System System.out "NO" System.exit(0) System.exit System 0 allLength -= strLength allLength strLength if (allLength == 0) {
                System.out.println("YES");
                System.exit(0);
            } allLength == 0 allLength 0 {
                System.out.println("YES");
                System.exit(0);
            } System.out.println("YES") System.out.println System.out System System.out "YES" System.exit(0) System.exit System 0 strLength = 0 strLength 0 String[] args args public class Main {
    public static void main(String[] args) {
        String[] strings = new String[]{
            "dream",
            "dreamer",
            "erase",
            "eraser"
        };

        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        int allLength = S.length();
        int strLength = 0;
        while (true) {
            for (int i = 0; i < strings.length; i++) {
                int restLength = allLength - strings[i].length();
                if (restLength < 0) {
                    continue;
                }
                if ((S.substring(restLength, allLength)).equals(strings[i])) {
                    strLength = strings[i].length();
                    break;
                }
            }
            if (strLength == 0) {
                System.out.println("NO");
                System.exit(0);
            }
            allLength -= strLength;
            if (allLength == 0) {
                System.out.println("YES");
                System.exit(0);
            }
            strLength = 0;
        }
    }
} public class Main {
    public static void main(String[] args) {
        String[] strings = new String[]{
            "dream",
            "dreamer",
            "erase",
            "eraser"
        };

        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        int allLength = S.length();
        int strLength = 0;
        while (true) {
            for (int i = 0; i < strings.length; i++) {
                int restLength = allLength - strings[i].length();
                if (restLength < 0) {
                    continue;
                }
                if ((S.substring(restLength, allLength)).equals(strings[i])) {
                    strLength = strings[i].length();
                    break;
                }
            }
            if (strLength == 0) {
                System.out.println("NO");
                System.exit(0);
            }
            allLength -= strLength;
            if (allLength == 0) {
                System.out.println("YES");
                System.exit(0);
            }
            strLength = 0;
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        String[] strings = new String[]{
            "dream",
            "dreamer",
            "erase",
            "eraser"
        };

        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        int allLength = S.length();
        int strLength = 0;
        while (true) {
            for (int i = 0; i < strings.length; i++) {
                int restLength = allLength - strings[i].length();
                if (restLength < 0) {
                    continue;
                }
                if ((S.substring(restLength, allLength)).equals(strings[i])) {
                    strLength = strings[i].length();
                    break;
                }
            }
            if (strLength == 0) {
                System.out.println("NO");
                System.exit(0);
            }
            allLength -= strLength;
            if (allLength == 0) {
                System.out.println("YES");
                System.exit(0);
            }
            strLength = 0;
        }
    }
}
