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();

        Pattern p = Pattern.compile("^(dream|dreamer|erase|eraser)*");
        Matcher m = p.matcher(S);
        if (m.matches()) {
            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();

        Pattern p = Pattern.compile("^(dream|dreamer|erase|eraser)*");
        Matcher m = p.matcher(S);
        if (m.matches()) {
            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();

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

        Pattern p = Pattern.compile("^(dream|dreamer|erase|eraser)*");
        Matcher m = p.matcher(S);
        if (m.matches()) {
            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 Pattern p = Pattern.compile("^(dream|dreamer|erase|eraser)*"); p Pattern.compile("^(dream|dreamer|erase|eraser)*") Pattern.compile Pattern "^(dream|dreamer|erase|eraser)*" Matcher m = p.matcher(S); m p.matcher(S) p.matcher p S if (m.matches()) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        } m.matches() m.matches m {
            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();

        Pattern p = Pattern.compile("^(dream|dreamer|erase|eraser)*");
        Matcher m = p.matcher(S);
        if (m.matches()) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}