import java.util.*;
import java.util.regex.*;

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

        if (Pattern.matches("^(dream|dreamer|erase|eraser)*", S)) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} import java.util.*; util.* java import java.util.regex.*; regex.* java.util class Main {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        final String S = sc.next();
        sc.close();

        if (Pattern.matches("^(dream|dreamer|erase|eraser)*", S)) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} Main public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        final String S = sc.next();
        sc.close();

        if (Pattern.matches("^(dream|dreamer|erase|eraser)*", S)) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    } main {
        final Scanner sc = new Scanner(System.in);
        final String S = sc.next();
        sc.close();

        if (Pattern.matches("^(dream|dreamer|erase|eraser)*", S)) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    } final Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final String S = sc.next(); S sc.next() sc.next sc sc.close() sc.close sc if (Pattern.matches("^(dream|dreamer|erase|eraser)*", S)) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        } Pattern.matches("^(dream|dreamer|erase|eraser)*", S) Pattern.matches Pattern "^(dream|dreamer|erase|eraser)*" S {
            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
import java.util.*;
import java.util.regex.*;

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

        if (Pattern.matches("^(dream|dreamer|erase|eraser)*", S)) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}