import java.util.*;

class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        final String[] ss = {"dream", "dreamer", "erase", "eraser"};

        int r = s.length();
        while (r > 0) {

            boolean isFound = false;
            for (String x : ss) {
                if (r - x.length() < 0) {
                    // System.out.println(s);
                    continue;
                }
                String subs = s.substring((r - x.length()), r);
                // System.out.println(subs);
                if (x.equals(subs)) {
                    r -= x.length();
                    isFound = true;
                    break;
                }
            }
            if (!isFound) {
                System.out.println("NO");
                return;
            }
        }


        System.out.println("YES");
        sc.close();
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        final String[] ss = {"dream", "dreamer", "erase", "eraser"};

        int r = s.length();
        while (r > 0) {

            boolean isFound = false;
            for (String x : ss) {
                if (r - x.length() < 0) {
                    // System.out.println(s);
                    continue;
                }
                String subs = s.substring((r - x.length()), r);
                // System.out.println(subs);
                if (x.equals(subs)) {
                    r -= x.length();
                    isFound = true;
                    break;
                }
            }
            if (!isFound) {
                System.out.println("NO");
                return;
            }
        }


        System.out.println("YES");
        sc.close();
    }
} Main public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        final String[] ss = {"dream", "dreamer", "erase", "eraser"};

        int r = s.length();
        while (r > 0) {

            boolean isFound = false;
            for (String x : ss) {
                if (r - x.length() < 0) {
                    // System.out.println(s);
                    continue;
                }
                String subs = s.substring((r - x.length()), r);
                // System.out.println(subs);
                if (x.equals(subs)) {
                    r -= x.length();
                    isFound = true;
                    break;
                }
            }
            if (!isFound) {
                System.out.println("NO");
                return;
            }
        }


        System.out.println("YES");
        sc.close();
    } main {

        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        final String[] ss = {"dream", "dreamer", "erase", "eraser"};

        int r = s.length();
        while (r > 0) {

            boolean isFound = false;
            for (String x : ss) {
                if (r - x.length() < 0) {
                    // System.out.println(s);
                    continue;
                }
                String subs = s.substring((r - x.length()), r);
                // System.out.println(subs);
                if (x.equals(subs)) {
                    r -= x.length();
                    isFound = true;
                    break;
                }
            }
            if (!isFound) {
                System.out.println("NO");
                return;
            }
        }


        System.out.println("YES");
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc final String[] ss = {"dream", "dreamer", "erase", "eraser"}; ss {"dream", "dreamer", "erase", "eraser"} "dream" "dreamer" "erase" "eraser" int r = s.length(); r s.length() s.length s while (r > 0) {

            boolean isFound = false;
            for (String x : ss) {
                if (r - x.length() < 0) {
                    // System.out.println(s);
                    continue;
                }
                String subs = s.substring((r - x.length()), r);
                // System.out.println(subs);
                if (x.equals(subs)) {
                    r -= x.length();
                    isFound = true;
                    break;
                }
            }
            if (!isFound) {
                System.out.println("NO");
                return;
            }
        } r > 0 r 0 {

            boolean isFound = false;
            for (String x : ss) {
                if (r - x.length() < 0) {
                    // System.out.println(s);
                    continue;
                }
                String subs = s.substring((r - x.length()), r);
                // System.out.println(subs);
                if (x.equals(subs)) {
                    r -= x.length();
                    isFound = true;
                    break;
                }
            }
            if (!isFound) {
                System.out.println("NO");
                return;
            }
        } boolean isFound = false; isFound false for (String x : ss) {
                if (r - x.length() < 0) {
                    // System.out.println(s);
                    continue;
                }
                String subs = s.substring((r - x.length()), r);
                // System.out.println(subs);
                if (x.equals(subs)) {
                    r -= x.length();
                    isFound = true;
                    break;
                }
            } String x ss {
                if (r - x.length() < 0) {
                    // System.out.println(s);
                    continue;
                }
                String subs = s.substring((r - x.length()), r);
                // System.out.println(subs);
                if (x.equals(subs)) {
                    r -= x.length();
                    isFound = true;
                    break;
                }
            } {
                if (r - x.length() < 0) {
                    // System.out.println(s);
                    continue;
                }
                String subs = s.substring((r - x.length()), r);
                // System.out.println(subs);
                if (x.equals(subs)) {
                    r -= x.length();
                    isFound = true;
                    break;
                }
            } if (r - x.length() < 0) {
                    // System.out.println(s);
                    continue;
                } r - x.length() < 0 r - x.length() r x.length() x.length x 0 {
                    // System.out.println(s);
                    continue;
                } continue; String subs = s.substring((r - x.length()), r); subs s.substring((r - x.length()), r) s.substring s (r - x.length()) r x.length() x.length x r if (x.equals(subs)) {
                    r -= x.length();
                    isFound = true;
                    break;
                } x.equals(subs) x.equals x subs {
                    r -= x.length();
                    isFound = true;
                    break;
                } r -= x.length() r x.length() x.length x isFound = true isFound true break; if (!isFound) {
                System.out.println("NO");
                return;
            } !isFound isFound {
                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" sc.close() sc.close sc String[] args args
import java.util.*;

class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        final String[] ss = {"dream", "dreamer", "erase", "eraser"};

        int r = s.length();
        while (r > 0) {

            boolean isFound = false;
            for (String x : ss) {
                if (r - x.length() < 0) {
                    // System.out.println(s);
                    continue;
                }
                String subs = s.substring((r - x.length()), r);
                // System.out.println(subs);
                if (x.equals(subs)) {
                    r -= x.length();
                    isFound = true;
                    break;
                }
            }
            if (!isFound) {
                System.out.println("NO");
                return;
            }
        }


        System.out.println("YES");
        sc.close();
    }
}
