import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        String S = cin.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.isEmpty()) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        String S = cin.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.isEmpty()) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} Main public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        String S = cin.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.isEmpty()) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    } main {
        Scanner cin = new Scanner(System.in);
        String S = cin.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.isEmpty()) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    } Scanner cin = new Scanner(System.in); cin new Scanner(System.in) String S = cin.next(); S cin.next() cin.next cin 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.isEmpty()) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        } S.isEmpty() S.isEmpty S {
            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 cin = new Scanner(System.in);
        String S = cin.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.isEmpty()) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        String S = cin.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.isEmpty()) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        String S = cin.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.isEmpty()) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}