import java.util.Scanner;

public class Main {

    private static final String[] words = {"eraser", "erase", "dreamer", "dream"};

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        for (int i = 0; i < words.length; i++) {
            s = s.replaceAll(words[i], "");
        }
        if (s.equals("")) {
            System.out.println("YES");
            return;
        }
        System.out.println("NO");
    }

} import java.util.Scanner; Scanner java.util public class Main {

    private static final String[] words = {"eraser", "erase", "dreamer", "dream"};

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        for (int i = 0; i < words.length; i++) {
            s = s.replaceAll(words[i], "");
        }
        if (s.equals("")) {
            System.out.println("YES");
            return;
        }
        System.out.println("NO");
    }

} Main private static final String[] words = {"eraser", "erase", "dreamer", "dream"}; words {"eraser", "erase", "dreamer", "dream"} "eraser" "erase" "dreamer" "dream" public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        for (int i = 0; i < words.length; i++) {
            s = s.replaceAll(words[i], "");
        }
        if (s.equals("")) {
            System.out.println("YES");
            return;
        }
        System.out.println("NO");
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        for (int i = 0; i < words.length; i++) {
            s = s.replaceAll(words[i], "");
        }
        if (s.equals("")) {
            System.out.println("YES");
            return;
        }
        System.out.println("NO");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc for (int i = 0; i < words.length; i++) {
            s = s.replaceAll(words[i], "");
        } int i = 0; int i = 0; i 0 i < words.length i words.length words words.length i++ i++ i {
            s = s.replaceAll(words[i], "");
        } {
            s = s.replaceAll(words[i], "");
        } s = s.replaceAll(words[i], "") s s.replaceAll(words[i], "") s.replaceAll s words[i] words i "" if (s.equals("")) {
            System.out.println("YES");
            return;
        } s.equals("") s.equals s "" {
            System.out.println("YES");
            return;
        } System.out.println("YES") System.out.println System.out System System.out "YES" return; System.out.println("NO") System.out.println System.out System System.out "NO" String[] args args public class Main {

    private static final String[] words = {"eraser", "erase", "dreamer", "dream"};

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        for (int i = 0; i < words.length; i++) {
            s = s.replaceAll(words[i], "");
        }
        if (s.equals("")) {
            System.out.println("YES");
            return;
        }
        System.out.println("NO");
    }

} public class Main {

    private static final String[] words = {"eraser", "erase", "dreamer", "dream"};

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        for (int i = 0; i < words.length; i++) {
            s = s.replaceAll(words[i], "");
        }
        if (s.equals("")) {
            System.out.println("YES");
            return;
        }
        System.out.println("NO");
    }

} Main
import java.util.Scanner;

public class Main {

    private static final String[] words = {"eraser", "erase", "dreamer", "dream"};

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        for (int i = 0; i < words.length; i++) {
            s = s.replaceAll(words[i], "");
        }
        if (s.equals("")) {
            System.out.println("YES");
            return;
        }
        System.out.println("NO");
    }

}
