import java.util.Scanner;

public class Main {

    static String DRM = "dream";
    static String DRMR = "dreamer";
    static String ERS = "erase";
    static String ERSR = "eraser";

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

        String n1 = N.replace(ERSR, "");
        String n2 = n1.replace(ERS, "");
        String n3 = n2.replace(DRMR, "");
        String n4 = n3.replace(DRM, "");
        System.out.println(n4.equals("") ? "YES" : "NO");
    }

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

    static String DRM = "dream";
    static String DRMR = "dreamer";
    static String ERS = "erase";
    static String ERSR = "eraser";

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

        String n1 = N.replace(ERSR, "");
        String n2 = n1.replace(ERS, "");
        String n3 = n2.replace(DRMR, "");
        String n4 = n3.replace(DRM, "");
        System.out.println(n4.equals("") ? "YES" : "NO");
    }

} Main static String DRM = "dream"; DRM "dream" static String DRMR = "dreamer"; DRMR "dreamer" static String ERS = "erase"; ERS "erase" static String ERSR = "eraser"; ERSR "eraser" public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String N = sc.nextLine();

        String n1 = N.replace(ERSR, "");
        String n2 = n1.replace(ERS, "");
        String n3 = n2.replace(DRMR, "");
        String n4 = n3.replace(DRM, "");
        System.out.println(n4.equals("") ? "YES" : "NO");
    } main {
        Scanner sc = new Scanner(System.in);
        String N = sc.nextLine();

        String n1 = N.replace(ERSR, "");
        String n2 = n1.replace(ERS, "");
        String n3 = n2.replace(DRMR, "");
        String n4 = n3.replace(DRM, "");
        System.out.println(n4.equals("") ? "YES" : "NO");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String N = sc.nextLine(); N sc.nextLine() sc.nextLine sc String n1 = N.replace(ERSR, ""); n1 N.replace(ERSR, "") N.replace N ERSR "" String n2 = n1.replace(ERS, ""); n2 n1.replace(ERS, "") n1.replace n1 ERS "" String n3 = n2.replace(DRMR, ""); n3 n2.replace(DRMR, "") n2.replace n2 DRMR "" String n4 = n3.replace(DRM, ""); n4 n3.replace(DRM, "") n3.replace n3 DRM "" System.out.println(n4.equals("") ? "YES" : "NO") System.out.println System.out System System.out n4.equals("") ? "YES" : "NO" n4.equals("") n4.equals n4 "" "YES" "NO" String[] args args public class Main {

    static String DRM = "dream";
    static String DRMR = "dreamer";
    static String ERS = "erase";
    static String ERSR = "eraser";

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

        String n1 = N.replace(ERSR, "");
        String n2 = n1.replace(ERS, "");
        String n3 = n2.replace(DRMR, "");
        String n4 = n3.replace(DRM, "");
        System.out.println(n4.equals("") ? "YES" : "NO");
    }

} public class Main {

    static String DRM = "dream";
    static String DRMR = "dreamer";
    static String ERS = "erase";
    static String ERSR = "eraser";

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

        String n1 = N.replace(ERSR, "");
        String n2 = n1.replace(ERS, "");
        String n3 = n2.replace(DRMR, "");
        String n4 = n3.replace(DRM, "");
        System.out.println(n4.equals("") ? "YES" : "NO");
    }

} Main
import java.util.Scanner;

public class Main {

    static String DRM = "dream";
    static String DRMR = "dreamer";
    static String ERS = "erase";
    static String ERSR = "eraser";

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

        String n1 = N.replace(ERSR, "");
        String n2 = n1.replace(ERS, "");
        String n3 = n2.replace(DRMR, "");
        String n4 = n3.replace(DRM, "");
        System.out.println(n4.equals("") ? "YES" : "NO");
    }

}
