import java.util.Scanner;

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

        String s = sc.next();
        String[] test = {"dreamer", "dream", "eraser", "erase"};
        boolean isAns = true;

        int index = s.length();
        while (index > 0) {
            boolean isCheck = false;
            for (int i = 0; i < 4; i++) {
                int start = Math.max(index-test[i].length(), 0);
                String sub = s.substring(start, index);
                if (sub.equals(test[i])) {
                    isCheck = true;
                    index = start;
                    break;
                }
            }

            if (!isCheck) {
                isAns = false;
                break;
            }
        }

        System.out.println(isAns ? "YES" : "NO");
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String[] test = {"dreamer", "dream", "eraser", "erase"};
        boolean isAns = true;

        int index = s.length();
        while (index > 0) {
            boolean isCheck = false;
            for (int i = 0; i < 4; i++) {
                int start = Math.max(index-test[i].length(), 0);
                String sub = s.substring(start, index);
                if (sub.equals(test[i])) {
                    isCheck = true;
                    index = start;
                    break;
                }
            }

            if (!isCheck) {
                isAns = false;
                break;
            }
        }

        System.out.println(isAns ? "YES" : "NO");
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String[] test = {"dreamer", "dream", "eraser", "erase"};
        boolean isAns = true;

        int index = s.length();
        while (index > 0) {
            boolean isCheck = false;
            for (int i = 0; i < 4; i++) {
                int start = Math.max(index-test[i].length(), 0);
                String sub = s.substring(start, index);
                if (sub.equals(test[i])) {
                    isCheck = true;
                    index = start;
                    break;
                }
            }

            if (!isCheck) {
                isAns = false;
                break;
            }
        }

        System.out.println(isAns ? "YES" : "NO");
    } main {
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String[] test = {"dreamer", "dream", "eraser", "erase"};
        boolean isAns = true;

        int index = s.length();
        while (index > 0) {
            boolean isCheck = false;
            for (int i = 0; i < 4; i++) {
                int start = Math.max(index-test[i].length(), 0);
                String sub = s.substring(start, index);
                if (sub.equals(test[i])) {
                    isCheck = true;
                    index = start;
                    break;
                }
            }

            if (!isCheck) {
                isAns = false;
                break;
            }
        }

        System.out.println(isAns ? "YES" : "NO");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String[] test = {"dreamer", "dream", "eraser", "erase"}; test {"dreamer", "dream", "eraser", "erase"} "dreamer" "dream" "eraser" "erase" boolean isAns = true; isAns true int index = s.length(); index s.length() s.length s while (index > 0) {
            boolean isCheck = false;
            for (int i = 0; i < 4; i++) {
                int start = Math.max(index-test[i].length(), 0);
                String sub = s.substring(start, index);
                if (sub.equals(test[i])) {
                    isCheck = true;
                    index = start;
                    break;
                }
            }

            if (!isCheck) {
                isAns = false;
                break;
            }
        } index > 0 index 0 {
            boolean isCheck = false;
            for (int i = 0; i < 4; i++) {
                int start = Math.max(index-test[i].length(), 0);
                String sub = s.substring(start, index);
                if (sub.equals(test[i])) {
                    isCheck = true;
                    index = start;
                    break;
                }
            }

            if (!isCheck) {
                isAns = false;
                break;
            }
        } boolean isCheck = false; isCheck false for (int i = 0; i < 4; i++) {
                int start = Math.max(index-test[i].length(), 0);
                String sub = s.substring(start, index);
                if (sub.equals(test[i])) {
                    isCheck = true;
                    index = start;
                    break;
                }
            } int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
                int start = Math.max(index-test[i].length(), 0);
                String sub = s.substring(start, index);
                if (sub.equals(test[i])) {
                    isCheck = true;
                    index = start;
                    break;
                }
            } {
                int start = Math.max(index-test[i].length(), 0);
                String sub = s.substring(start, index);
                if (sub.equals(test[i])) {
                    isCheck = true;
                    index = start;
                    break;
                }
            } int start = Math.max(index-test[i].length(), 0); start Math.max(index-test[i].length(), 0) Math.max Math index-test[i].length() index test[i].length() test[i].length test[i] test i 0 String sub = s.substring(start, index); sub s.substring(start, index) s.substring s start index if (sub.equals(test[i])) {
                    isCheck = true;
                    index = start;
                    break;
                } sub.equals(test[i]) sub.equals sub test[i] test i {
                    isCheck = true;
                    index = start;
                    break;
                } isCheck = true isCheck true index = start index start break; if (!isCheck) {
                isAns = false;
                break;
            } !isCheck isCheck {
                isAns = false;
                break;
            } isAns = false isAns false break; System.out.println(isAns ? "YES" : "NO") System.out.println System.out System System.out isAns ? "YES" : "NO" isAns "YES" "NO" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String[] test = {"dreamer", "dream", "eraser", "erase"};
        boolean isAns = true;

        int index = s.length();
        while (index > 0) {
            boolean isCheck = false;
            for (int i = 0; i < 4; i++) {
                int start = Math.max(index-test[i].length(), 0);
                String sub = s.substring(start, index);
                if (sub.equals(test[i])) {
                    isCheck = true;
                    index = start;
                    break;
                }
            }

            if (!isCheck) {
                isAns = false;
                break;
            }
        }

        System.out.println(isAns ? "YES" : "NO");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String[] test = {"dreamer", "dream", "eraser", "erase"};
        boolean isAns = true;

        int index = s.length();
        while (index > 0) {
            boolean isCheck = false;
            for (int i = 0; i < 4; i++) {
                int start = Math.max(index-test[i].length(), 0);
                String sub = s.substring(start, index);
                if (sub.equals(test[i])) {
                    isCheck = true;
                    index = start;
                    break;
                }
            }

            if (!isCheck) {
                isAns = false;
                break;
            }
        }

        System.out.println(isAns ? "YES" : "NO");
    }
} Main
import java.util.Scanner;

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

        String s = sc.next();
        String[] test = {"dreamer", "dream", "eraser", "erase"};
        boolean isAns = true;

        int index = s.length();
        while (index > 0) {
            boolean isCheck = false;
            for (int i = 0; i < 4; i++) {
                int start = Math.max(index-test[i].length(), 0);
                String sub = s.substring(start, index);
                if (sub.equals(test[i])) {
                    isCheck = true;
                    index = start;
                    break;
                }
            }

            if (!isCheck) {
                isAns = false;
                break;
            }
        }

        System.out.println(isAns ? "YES" : "NO");
    }
}
