import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        String s = std.next();
        String reversed = new StringBuilder(s).reverse().toString();

        String[] texts = {"dream", "dreamer", "erase", "eraser"};
        String[] reversedText = new String[texts.length];
        for (int i = 0; i < texts.length; i++) {
            reversedText[i] = new StringBuilder(texts[i]).reverse().toString();
        }

        StringBuilder sb = new StringBuilder(reversed);
        while (sb.length() != 0) {
            boolean updated = false;
            for (int i = 0; i < reversedText.length; i++) {
                String r = reversedText[i];
                if (sb.indexOf(r) == 0) {
                    sb.delete(0, r.length());
                    updated = true;
                    break;
                }
            }

            if (!updated) {
                System.out.println("NO");
                return;
            }
        }

        System.out.println("YES");
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        String s = std.next();
        String reversed = new StringBuilder(s).reverse().toString();

        String[] texts = {"dream", "dreamer", "erase", "eraser"};
        String[] reversedText = new String[texts.length];
        for (int i = 0; i < texts.length; i++) {
            reversedText[i] = new StringBuilder(texts[i]).reverse().toString();
        }

        StringBuilder sb = new StringBuilder(reversed);
        while (sb.length() != 0) {
            boolean updated = false;
            for (int i = 0; i < reversedText.length; i++) {
                String r = reversedText[i];
                if (sb.indexOf(r) == 0) {
                    sb.delete(0, r.length());
                    updated = true;
                    break;
                }
            }

            if (!updated) {
                System.out.println("NO");
                return;
            }
        }

        System.out.println("YES");
    }
} Main public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        String s = std.next();
        String reversed = new StringBuilder(s).reverse().toString();

        String[] texts = {"dream", "dreamer", "erase", "eraser"};
        String[] reversedText = new String[texts.length];
        for (int i = 0; i < texts.length; i++) {
            reversedText[i] = new StringBuilder(texts[i]).reverse().toString();
        }

        StringBuilder sb = new StringBuilder(reversed);
        while (sb.length() != 0) {
            boolean updated = false;
            for (int i = 0; i < reversedText.length; i++) {
                String r = reversedText[i];
                if (sb.indexOf(r) == 0) {
                    sb.delete(0, r.length());
                    updated = true;
                    break;
                }
            }

            if (!updated) {
                System.out.println("NO");
                return;
            }
        }

        System.out.println("YES");
    } main {
        Scanner std = new Scanner(System.in);
        String s = std.next();
        String reversed = new StringBuilder(s).reverse().toString();

        String[] texts = {"dream", "dreamer", "erase", "eraser"};
        String[] reversedText = new String[texts.length];
        for (int i = 0; i < texts.length; i++) {
            reversedText[i] = new StringBuilder(texts[i]).reverse().toString();
        }

        StringBuilder sb = new StringBuilder(reversed);
        while (sb.length() != 0) {
            boolean updated = false;
            for (int i = 0; i < reversedText.length; i++) {
                String r = reversedText[i];
                if (sb.indexOf(r) == 0) {
                    sb.delete(0, r.length());
                    updated = true;
                    break;
                }
            }

            if (!updated) {
                System.out.println("NO");
                return;
            }
        }

        System.out.println("YES");
    } Scanner std = new Scanner(System.in); std new Scanner(System.in) String s = std.next(); s std.next() std.next std String reversed = new StringBuilder(s).reverse().toString(); reversed new StringBuilder(s).reverse().toString() new StringBuilder(s).reverse().toString new StringBuilder(s).reverse() new StringBuilder(s).reverse new StringBuilder(s) String[] texts = {"dream", "dreamer", "erase", "eraser"}; texts {"dream", "dreamer", "erase", "eraser"} "dream" "dreamer" "erase" "eraser" String[] reversedText = new String[texts.length]; reversedText new String[texts.length] texts.length texts texts.length for (int i = 0; i < texts.length; i++) {
            reversedText[i] = new StringBuilder(texts[i]).reverse().toString();
        } int i = 0; int i = 0; i 0 i < texts.length i texts.length texts texts.length i++ i++ i {
            reversedText[i] = new StringBuilder(texts[i]).reverse().toString();
        } {
            reversedText[i] = new StringBuilder(texts[i]).reverse().toString();
        } reversedText[i] = new StringBuilder(texts[i]).reverse().toString() reversedText[i] reversedText i new StringBuilder(texts[i]).reverse().toString() new StringBuilder(texts[i]).reverse().toString new StringBuilder(texts[i]).reverse() new StringBuilder(texts[i]).reverse new StringBuilder(texts[i]) StringBuilder sb = new StringBuilder(reversed); sb new StringBuilder(reversed) while (sb.length() != 0) {
            boolean updated = false;
            for (int i = 0; i < reversedText.length; i++) {
                String r = reversedText[i];
                if (sb.indexOf(r) == 0) {
                    sb.delete(0, r.length());
                    updated = true;
                    break;
                }
            }

            if (!updated) {
                System.out.println("NO");
                return;
            }
        } sb.length() != 0 sb.length() sb.length sb 0 {
            boolean updated = false;
            for (int i = 0; i < reversedText.length; i++) {
                String r = reversedText[i];
                if (sb.indexOf(r) == 0) {
                    sb.delete(0, r.length());
                    updated = true;
                    break;
                }
            }

            if (!updated) {
                System.out.println("NO");
                return;
            }
        } boolean updated = false; updated false for (int i = 0; i < reversedText.length; i++) {
                String r = reversedText[i];
                if (sb.indexOf(r) == 0) {
                    sb.delete(0, r.length());
                    updated = true;
                    break;
                }
            } int i = 0; int i = 0; i 0 i < reversedText.length i reversedText.length reversedText reversedText.length i++ i++ i {
                String r = reversedText[i];
                if (sb.indexOf(r) == 0) {
                    sb.delete(0, r.length());
                    updated = true;
                    break;
                }
            } {
                String r = reversedText[i];
                if (sb.indexOf(r) == 0) {
                    sb.delete(0, r.length());
                    updated = true;
                    break;
                }
            } String r = reversedText[i]; r reversedText[i] reversedText i if (sb.indexOf(r) == 0) {
                    sb.delete(0, r.length());
                    updated = true;
                    break;
                } sb.indexOf(r) == 0 sb.indexOf(r) sb.indexOf sb r 0 {
                    sb.delete(0, r.length());
                    updated = true;
                    break;
                } sb.delete(0, r.length()) sb.delete sb 0 r.length() r.length r updated = true updated true break; if (!updated) {
                System.out.println("NO");
                return;
            } !updated updated {
                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 std = new Scanner(System.in);
        String s = std.next();
        String reversed = new StringBuilder(s).reverse().toString();

        String[] texts = {"dream", "dreamer", "erase", "eraser"};
        String[] reversedText = new String[texts.length];
        for (int i = 0; i < texts.length; i++) {
            reversedText[i] = new StringBuilder(texts[i]).reverse().toString();
        }

        StringBuilder sb = new StringBuilder(reversed);
        while (sb.length() != 0) {
            boolean updated = false;
            for (int i = 0; i < reversedText.length; i++) {
                String r = reversedText[i];
                if (sb.indexOf(r) == 0) {
                    sb.delete(0, r.length());
                    updated = true;
                    break;
                }
            }

            if (!updated) {
                System.out.println("NO");
                return;
            }
        }

        System.out.println("YES");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        String s = std.next();
        String reversed = new StringBuilder(s).reverse().toString();

        String[] texts = {"dream", "dreamer", "erase", "eraser"};
        String[] reversedText = new String[texts.length];
        for (int i = 0; i < texts.length; i++) {
            reversedText[i] = new StringBuilder(texts[i]).reverse().toString();
        }

        StringBuilder sb = new StringBuilder(reversed);
        while (sb.length() != 0) {
            boolean updated = false;
            for (int i = 0; i < reversedText.length; i++) {
                String r = reversedText[i];
                if (sb.indexOf(r) == 0) {
                    sb.delete(0, r.length());
                    updated = true;
                    break;
                }
            }

            if (!updated) {
                System.out.println("NO");
                return;
            }
        }

        System.out.println("YES");
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        String s = std.next();
        String reversed = new StringBuilder(s).reverse().toString();

        String[] texts = {"dream", "dreamer", "erase", "eraser"};
        String[] reversedText = new String[texts.length];
        for (int i = 0; i < texts.length; i++) {
            reversedText[i] = new StringBuilder(texts[i]).reverse().toString();
        }

        StringBuilder sb = new StringBuilder(reversed);
        while (sb.length() != 0) {
            boolean updated = false;
            for (int i = 0; i < reversedText.length; i++) {
                String r = reversedText[i];
                if (sb.indexOf(r) == 0) {
                    sb.delete(0, r.length());
                    updated = true;
                    break;
                }
            }

            if (!updated) {
                System.out.println("NO");
                return;
            }
        }

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