import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        s = s.replaceAll("eraser", "0");
        s = s.replaceAll("erase", "0");
        s = s.replaceAll("dreamer", "0");
        s = s.replaceAll("dream", "0");
        s = s.replaceAll("0", "");
        if (s.length()== 0){
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

    }

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

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        s = s.replaceAll("eraser", "0");
        s = s.replaceAll("erase", "0");
        s = s.replaceAll("dreamer", "0");
        s = s.replaceAll("dream", "0");
        s = s.replaceAll("0", "");
        if (s.length()== 0){
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        s = s.replaceAll("eraser", "0");
        s = s.replaceAll("erase", "0");
        s = s.replaceAll("dreamer", "0");
        s = s.replaceAll("dream", "0");
        s = s.replaceAll("0", "");
        if (s.length()== 0){
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        s = s.replaceAll("eraser", "0");
        s = s.replaceAll("erase", "0");
        s = s.replaceAll("dreamer", "0");
        s = s.replaceAll("dream", "0");
        s = s.replaceAll("0", "");
        if (s.length()== 0){
            System.out.println("YES");
        } else {
            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 s = s.replaceAll("eraser", "0") s s.replaceAll("eraser", "0") s.replaceAll s "eraser" "0" s = s.replaceAll("erase", "0") s s.replaceAll("erase", "0") s.replaceAll s "erase" "0" s = s.replaceAll("dreamer", "0") s s.replaceAll("dreamer", "0") s.replaceAll s "dreamer" "0" s = s.replaceAll("dream", "0") s s.replaceAll("dream", "0") s.replaceAll s "dream" "0" s = s.replaceAll("0", "") s s.replaceAll("0", "") s.replaceAll s "0" "" if (s.length()== 0){
            System.out.println("YES");
        } else {
            System.out.println("NO");
        } s.length()== 0 s.length() s.length s 0 {
            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 public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        s = s.replaceAll("eraser", "0");
        s = s.replaceAll("erase", "0");
        s = s.replaceAll("dreamer", "0");
        s = s.replaceAll("dream", "0");
        s = s.replaceAll("0", "");
        if (s.length()== 0){
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

    }

} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        s = s.replaceAll("eraser", "0");
        s = s.replaceAll("erase", "0");
        s = s.replaceAll("dreamer", "0");
        s = s.replaceAll("dream", "0");
        s = s.replaceAll("0", "");
        if (s.length()== 0){
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

    }

} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        s = s.replaceAll("eraser", "0");
        s = s.replaceAll("erase", "0");
        s = s.replaceAll("dreamer", "0");
        s = s.replaceAll("dream", "0");
        s = s.replaceAll("0", "");
        if (s.length()== 0){
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

    }

}