import java.util.Scanner;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner s = new Scanner(System.in);
        String n = s.next();
        n = n.replaceAll("eraser", "");
        n = n.replaceAll("erase", "");
        n = n.replaceAll("dreamer", "");
        n = n.replaceAll("dream", "");
        
        System.out.println(n.length() == 0 ? "YES": "NO");

    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String args[]) throws Exception {
        Scanner s = new Scanner(System.in);
        String n = s.next();
        n = n.replaceAll("eraser", "");
        n = n.replaceAll("erase", "");
        n = n.replaceAll("dreamer", "");
        n = n.replaceAll("dream", "");
        
        System.out.println(n.length() == 0 ? "YES": "NO");

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

    } main {
        Scanner s = new Scanner(System.in);
        String n = s.next();
        n = n.replaceAll("eraser", "");
        n = n.replaceAll("erase", "");
        n = n.replaceAll("dreamer", "");
        n = n.replaceAll("dream", "");
        
        System.out.println(n.length() == 0 ? "YES": "NO");

    } Scanner s = new Scanner(System.in); s new Scanner(System.in) String n = s.next(); n s.next() s.next s n = n.replaceAll("eraser", "") n n.replaceAll("eraser", "") n.replaceAll n "eraser" "" n = n.replaceAll("erase", "") n n.replaceAll("erase", "") n.replaceAll n "erase" "" n = n.replaceAll("dreamer", "") n n.replaceAll("dreamer", "") n.replaceAll n "dreamer" "" n = n.replaceAll("dream", "") n n.replaceAll("dream", "") n.replaceAll n "dream" "" System.out.println(n.length() == 0 ? "YES": "NO") System.out.println System.out System System.out n.length() == 0 ? "YES": "NO" n.length() == 0 n.length() n.length n 0 "YES" "NO" String args[] args public class Main {
    public static void main(String args[]) throws Exception {
        Scanner s = new Scanner(System.in);
        String n = s.next();
        n = n.replaceAll("eraser", "");
        n = n.replaceAll("erase", "");
        n = n.replaceAll("dreamer", "");
        n = n.replaceAll("dream", "");
        
        System.out.println(n.length() == 0 ? "YES": "NO");

    }
} public class Main {
    public static void main(String args[]) throws Exception {
        Scanner s = new Scanner(System.in);
        String n = s.next();
        n = n.replaceAll("eraser", "");
        n = n.replaceAll("erase", "");
        n = n.replaceAll("dreamer", "");
        n = n.replaceAll("dream", "");
        
        System.out.println(n.length() == 0 ? "YES": "NO");

    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner s = new Scanner(System.in);
        String n = s.next();
        n = n.replaceAll("eraser", "");
        n = n.replaceAll("erase", "");
        n = n.replaceAll("dreamer", "");
        n = n.replaceAll("dream", "");
        
        System.out.println(n.length() == 0 ? "YES": "NO");

    }
}
