import java.util.*;

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

        StringBuffer sb;
        S = new StringBuffer(S).reverse().toString();

        for (int i = 0; i < A.length; i++) {
            sb = new StringBuffer(A[i]);
            A[i] = sb.reverse().toString();
        }

        int index = 0;
        while (index < S.length()) {
            boolean f = false;
            for (int i = 0; i < 4; i++) {
                if (S.substring(index, Math.min(index + A[i].length(), S.length())).equals(A[i])) {
                    f = true;
                    index += A[i].length();
                    break;
                }
            }
            if (!f) {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] A = {"dream", "dreamer", "erase", "eraser"};

        StringBuffer sb;
        S = new StringBuffer(S).reverse().toString();

        for (int i = 0; i < A.length; i++) {
            sb = new StringBuffer(A[i]);
            A[i] = sb.reverse().toString();
        }

        int index = 0;
        while (index < S.length()) {
            boolean f = false;
            for (int i = 0; i < 4; i++) {
                if (S.substring(index, Math.min(index + A[i].length(), S.length())).equals(A[i])) {
                    f = true;
                    index += A[i].length();
                    break;
                }
            }
            if (!f) {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] A = {"dream", "dreamer", "erase", "eraser"};

        StringBuffer sb;
        S = new StringBuffer(S).reverse().toString();

        for (int i = 0; i < A.length; i++) {
            sb = new StringBuffer(A[i]);
            A[i] = sb.reverse().toString();
        }

        int index = 0;
        while (index < S.length()) {
            boolean f = false;
            for (int i = 0; i < 4; i++) {
                if (S.substring(index, Math.min(index + A[i].length(), S.length())).equals(A[i])) {
                    f = true;
                    index += A[i].length();
                    break;
                }
            }
            if (!f) {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] A = {"dream", "dreamer", "erase", "eraser"};

        StringBuffer sb;
        S = new StringBuffer(S).reverse().toString();

        for (int i = 0; i < A.length; i++) {
            sb = new StringBuffer(A[i]);
            A[i] = sb.reverse().toString();
        }

        int index = 0;
        while (index < S.length()) {
            boolean f = false;
            for (int i = 0; i < 4; i++) {
                if (S.substring(index, Math.min(index + A[i].length(), S.length())).equals(A[i])) {
                    f = true;
                    index += A[i].length();
                    break;
                }
            }
            if (!f) {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String[] A = {"dream", "dreamer", "erase", "eraser"}; A {"dream", "dreamer", "erase", "eraser"} "dream" "dreamer" "erase" "eraser" StringBuffer sb; sb S = new StringBuffer(S).reverse().toString() S new StringBuffer(S).reverse().toString() new StringBuffer(S).reverse().toString new StringBuffer(S).reverse() new StringBuffer(S).reverse new StringBuffer(S) for (int i = 0; i < A.length; i++) {
            sb = new StringBuffer(A[i]);
            A[i] = sb.reverse().toString();
        } int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
            sb = new StringBuffer(A[i]);
            A[i] = sb.reverse().toString();
        } {
            sb = new StringBuffer(A[i]);
            A[i] = sb.reverse().toString();
        } sb = new StringBuffer(A[i]) sb new StringBuffer(A[i]) A[i] = sb.reverse().toString() A[i] A i sb.reverse().toString() sb.reverse().toString sb.reverse() sb.reverse sb int index = 0; index 0 while (index < S.length()) {
            boolean f = false;
            for (int i = 0; i < 4; i++) {
                if (S.substring(index, Math.min(index + A[i].length(), S.length())).equals(A[i])) {
                    f = true;
                    index += A[i].length();
                    break;
                }
            }
            if (!f) {
                System.out.println("NO");
                return;
            }
        } index < S.length() index S.length() S.length S {
            boolean f = false;
            for (int i = 0; i < 4; i++) {
                if (S.substring(index, Math.min(index + A[i].length(), S.length())).equals(A[i])) {
                    f = true;
                    index += A[i].length();
                    break;
                }
            }
            if (!f) {
                System.out.println("NO");
                return;
            }
        } boolean f = false; f false for (int i = 0; i < 4; i++) {
                if (S.substring(index, Math.min(index + A[i].length(), S.length())).equals(A[i])) {
                    f = true;
                    index += A[i].length();
                    break;
                }
            } int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
                if (S.substring(index, Math.min(index + A[i].length(), S.length())).equals(A[i])) {
                    f = true;
                    index += A[i].length();
                    break;
                }
            } {
                if (S.substring(index, Math.min(index + A[i].length(), S.length())).equals(A[i])) {
                    f = true;
                    index += A[i].length();
                    break;
                }
            } if (S.substring(index, Math.min(index + A[i].length(), S.length())).equals(A[i])) {
                    f = true;
                    index += A[i].length();
                    break;
                } S.substring(index, Math.min(index + A[i].length(), S.length())).equals(A[i]) S.substring(index, Math.min(index + A[i].length(), S.length())).equals S.substring(index, Math.min(index + A[i].length(), S.length())) S.substring S index Math.min(index + A[i].length(), S.length()) Math.min Math index + A[i].length() index A[i].length() A[i].length A[i] A i S.length() S.length S A[i] A i {
                    f = true;
                    index += A[i].length();
                    break;
                } f = true f true index += A[i].length() index A[i].length() A[i].length A[i] A i break; if (!f) {
                System.out.println("NO");
                return;
            } !f f {
                System.out.println("NO");
                return;
            } System.out.println("NO") System.out.println System.out System System.out "NO" return; System.out.println("YES") System.out.println System.out System System.out "YES" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] A = {"dream", "dreamer", "erase", "eraser"};

        StringBuffer sb;
        S = new StringBuffer(S).reverse().toString();

        for (int i = 0; i < A.length; i++) {
            sb = new StringBuffer(A[i]);
            A[i] = sb.reverse().toString();
        }

        int index = 0;
        while (index < S.length()) {
            boolean f = false;
            for (int i = 0; i < 4; i++) {
                if (S.substring(index, Math.min(index + A[i].length(), S.length())).equals(A[i])) {
                    f = true;
                    index += A[i].length();
                    break;
                }
            }
            if (!f) {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] A = {"dream", "dreamer", "erase", "eraser"};

        StringBuffer sb;
        S = new StringBuffer(S).reverse().toString();

        for (int i = 0; i < A.length; i++) {
            sb = new StringBuffer(A[i]);
            A[i] = sb.reverse().toString();
        }

        int index = 0;
        while (index < S.length()) {
            boolean f = false;
            for (int i = 0; i < 4; i++) {
                if (S.substring(index, Math.min(index + A[i].length(), S.length())).equals(A[i])) {
                    f = true;
                    index += A[i].length();
                    break;
                }
            }
            if (!f) {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
} Main
import java.util.*;

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

        StringBuffer sb;
        S = new StringBuffer(S).reverse().toString();

        for (int i = 0; i < A.length; i++) {
            sb = new StringBuffer(A[i]);
            A[i] = sb.reverse().toString();
        }

        int index = 0;
        while (index < S.length()) {
            boolean f = false;
            for (int i = 0; i < 4; i++) {
                if (S.substring(index, Math.min(index + A[i].length(), S.length())).equals(A[i])) {
                    f = true;
                    index += A[i].length();
                    break;
                }
            }
            if (!f) {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
}
