import java.io.ByteArrayInputStream;
import java.util.Scanner;

public class Main
{
    private static boolean strcmp(String s, int pos, String other) {
        if (pos >= other.length()) {
            int len = other.length();
            for (int i = 0; i < len; i++) {
                if (s.charAt(pos - i - 1) != other.charAt(len - i - 1)) {
                    return false;
                }
            }
            return true;
        }
        else {
            return false;
        }
    }

    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int pos = s.length();
        while (pos > 0) {
            if (strcmp(s, pos, "dream")) {
                pos -= 5;
            }
            else if (strcmp(s, pos, "dreamer")) {
                pos -= 7;
            }
            else if (strcmp(s, pos, "erase")) {
                pos -= 5;
            }
            else if (strcmp(s, pos, "eraser")) {
                pos -= 6;
            }
            else {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
} import java.io.ByteArrayInputStream; ByteArrayInputStream java.io import java.util.Scanner; Scanner java.util public class Main
{
    private static boolean strcmp(String s, int pos, String other) {
        if (pos >= other.length()) {
            int len = other.length();
            for (int i = 0; i < len; i++) {
                if (s.charAt(pos - i - 1) != other.charAt(len - i - 1)) {
                    return false;
                }
            }
            return true;
        }
        else {
            return false;
        }
    }

    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int pos = s.length();
        while (pos > 0) {
            if (strcmp(s, pos, "dream")) {
                pos -= 5;
            }
            else if (strcmp(s, pos, "dreamer")) {
                pos -= 7;
            }
            else if (strcmp(s, pos, "erase")) {
                pos -= 5;
            }
            else if (strcmp(s, pos, "eraser")) {
                pos -= 6;
            }
            else {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
} Main private static boolean strcmp(String s, int pos, String other) {
        if (pos >= other.length()) {
            int len = other.length();
            for (int i = 0; i < len; i++) {
                if (s.charAt(pos - i - 1) != other.charAt(len - i - 1)) {
                    return false;
                }
            }
            return true;
        }
        else {
            return false;
        }
    } strcmp {
        if (pos >= other.length()) {
            int len = other.length();
            for (int i = 0; i < len; i++) {
                if (s.charAt(pos - i - 1) != other.charAt(len - i - 1)) {
                    return false;
                }
            }
            return true;
        }
        else {
            return false;
        }
    } if (pos >= other.length()) {
            int len = other.length();
            for (int i = 0; i < len; i++) {
                if (s.charAt(pos - i - 1) != other.charAt(len - i - 1)) {
                    return false;
                }
            }
            return true;
        }
        else {
            return false;
        } pos >= other.length() pos other.length() other.length other {
            int len = other.length();
            for (int i = 0; i < len; i++) {
                if (s.charAt(pos - i - 1) != other.charAt(len - i - 1)) {
                    return false;
                }
            }
            return true;
        } int len = other.length(); len other.length() other.length other for (int i = 0; i < len; i++) {
                if (s.charAt(pos - i - 1) != other.charAt(len - i - 1)) {
                    return false;
                }
            } int i = 0; int i = 0; i 0 i < len i len i++ i++ i {
                if (s.charAt(pos - i - 1) != other.charAt(len - i - 1)) {
                    return false;
                }
            } {
                if (s.charAt(pos - i - 1) != other.charAt(len - i - 1)) {
                    return false;
                }
            } if (s.charAt(pos - i - 1) != other.charAt(len - i - 1)) {
                    return false;
                } s.charAt(pos - i - 1) != other.charAt(len - i - 1) s.charAt(pos - i - 1) s.charAt s pos - i - 1 pos - i - 1 pos i 1 other.charAt(len - i - 1) other.charAt other len - i - 1 len - i - 1 len i 1 {
                    return false;
                } return false; false return true; true {
            return false;
        } return false; false String s s int pos pos String other other public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int pos = s.length();
        while (pos > 0) {
            if (strcmp(s, pos, "dream")) {
                pos -= 5;
            }
            else if (strcmp(s, pos, "dreamer")) {
                pos -= 7;
            }
            else if (strcmp(s, pos, "erase")) {
                pos -= 5;
            }
            else if (strcmp(s, pos, "eraser")) {
                pos -= 6;
            }
            else {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int pos = s.length();
        while (pos > 0) {
            if (strcmp(s, pos, "dream")) {
                pos -= 5;
            }
            else if (strcmp(s, pos, "dreamer")) {
                pos -= 7;
            }
            else if (strcmp(s, pos, "erase")) {
                pos -= 5;
            }
            else if (strcmp(s, pos, "eraser")) {
                pos -= 6;
            }
            else {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc int pos = s.length(); pos s.length() s.length s while (pos > 0) {
            if (strcmp(s, pos, "dream")) {
                pos -= 5;
            }
            else if (strcmp(s, pos, "dreamer")) {
                pos -= 7;
            }
            else if (strcmp(s, pos, "erase")) {
                pos -= 5;
            }
            else if (strcmp(s, pos, "eraser")) {
                pos -= 6;
            }
            else {
                System.out.println("NO");
                return;
            }
        } pos > 0 pos 0 {
            if (strcmp(s, pos, "dream")) {
                pos -= 5;
            }
            else if (strcmp(s, pos, "dreamer")) {
                pos -= 7;
            }
            else if (strcmp(s, pos, "erase")) {
                pos -= 5;
            }
            else if (strcmp(s, pos, "eraser")) {
                pos -= 6;
            }
            else {
                System.out.println("NO");
                return;
            }
        } if (strcmp(s, pos, "dream")) {
                pos -= 5;
            }
            else if (strcmp(s, pos, "dreamer")) {
                pos -= 7;
            }
            else if (strcmp(s, pos, "erase")) {
                pos -= 5;
            }
            else if (strcmp(s, pos, "eraser")) {
                pos -= 6;
            }
            else {
                System.out.println("NO");
                return;
            } strcmp(s, pos, "dream") strcmp s pos "dream" {
                pos -= 5;
            } pos -= 5 pos 5 if (strcmp(s, pos, "dreamer")) {
                pos -= 7;
            }
            else if (strcmp(s, pos, "erase")) {
                pos -= 5;
            }
            else if (strcmp(s, pos, "eraser")) {
                pos -= 6;
            }
            else {
                System.out.println("NO");
                return;
            } strcmp(s, pos, "dreamer") strcmp s pos "dreamer" {
                pos -= 7;
            } pos -= 7 pos 7 if (strcmp(s, pos, "erase")) {
                pos -= 5;
            }
            else if (strcmp(s, pos, "eraser")) {
                pos -= 6;
            }
            else {
                System.out.println("NO");
                return;
            } strcmp(s, pos, "erase") strcmp s pos "erase" {
                pos -= 5;
            } pos -= 5 pos 5 if (strcmp(s, pos, "eraser")) {
                pos -= 6;
            }
            else {
                System.out.println("NO");
                return;
            } strcmp(s, pos, "eraser") strcmp s pos "eraser" {
                pos -= 6;
            } pos -= 6 pos 6 {
                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
{
    private static boolean strcmp(String s, int pos, String other) {
        if (pos >= other.length()) {
            int len = other.length();
            for (int i = 0; i < len; i++) {
                if (s.charAt(pos - i - 1) != other.charAt(len - i - 1)) {
                    return false;
                }
            }
            return true;
        }
        else {
            return false;
        }
    }

    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int pos = s.length();
        while (pos > 0) {
            if (strcmp(s, pos, "dream")) {
                pos -= 5;
            }
            else if (strcmp(s, pos, "dreamer")) {
                pos -= 7;
            }
            else if (strcmp(s, pos, "erase")) {
                pos -= 5;
            }
            else if (strcmp(s, pos, "eraser")) {
                pos -= 6;
            }
            else {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
} public class Main
{
    private static boolean strcmp(String s, int pos, String other) {
        if (pos >= other.length()) {
            int len = other.length();
            for (int i = 0; i < len; i++) {
                if (s.charAt(pos - i - 1) != other.charAt(len - i - 1)) {
                    return false;
                }
            }
            return true;
        }
        else {
            return false;
        }
    }

    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int pos = s.length();
        while (pos > 0) {
            if (strcmp(s, pos, "dream")) {
                pos -= 5;
            }
            else if (strcmp(s, pos, "dreamer")) {
                pos -= 7;
            }
            else if (strcmp(s, pos, "erase")) {
                pos -= 5;
            }
            else if (strcmp(s, pos, "eraser")) {
                pos -= 6;
            }
            else {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
} Main
import java.io.ByteArrayInputStream;
import java.util.Scanner;

public class Main
{
    private static boolean strcmp(String s, int pos, String other) {
        if (pos >= other.length()) {
            int len = other.length();
            for (int i = 0; i < len; i++) {
                if (s.charAt(pos - i - 1) != other.charAt(len - i - 1)) {
                    return false;
                }
            }
            return true;
        }
        else {
            return false;
        }
    }

    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int pos = s.length();
        while (pos > 0) {
            if (strcmp(s, pos, "dream")) {
                pos -= 5;
            }
            else if (strcmp(s, pos, "dreamer")) {
                pos -= 7;
            }
            else if (strcmp(s, pos, "erase")) {
                pos -= 5;
            }
            else if (strcmp(s, pos, "eraser")) {
                pos -= 6;
            }
            else {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
}
