import java.util.*;

class Main {
    static String divide[] = {
        "dream",
        "dreamer",
        "erase",
        "eraser"
    };

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

        int index = S.length();
        boolean canDiv;
        while (true) {
            boolean isFit = false;
            for (String d: divide) {
                if (d.length() > index) continue;
                String substr = S.substring(index - d.length(), index);
                if (d.equals(substr)) {
                    index -= d.length();
                    isFit = true;
                    break;
                }
            }
            if (!isFit) {
                canDiv = false;
                break;
            }
            if (index == 0) {
                canDiv = true;
                break;
            }
        }

        if (canDiv)
            System.out.println("YES");
        else
            System.out.println("NO");
    }
} import java.util.*; util.* java class Main {
    static String divide[] = {
        "dream",
        "dreamer",
        "erase",
        "eraser"
    };

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

        int index = S.length();
        boolean canDiv;
        while (true) {
            boolean isFit = false;
            for (String d: divide) {
                if (d.length() > index) continue;
                String substr = S.substring(index - d.length(), index);
                if (d.equals(substr)) {
                    index -= d.length();
                    isFit = true;
                    break;
                }
            }
            if (!isFit) {
                canDiv = false;
                break;
            }
            if (index == 0) {
                canDiv = true;
                break;
            }
        }

        if (canDiv)
            System.out.println("YES");
        else
            System.out.println("NO");
    }
} Main static String divide[] = {
        "dream",
        "dreamer",
        "erase",
        "eraser"
    }; divide {
        "dream",
        "dreamer",
        "erase",
        "eraser"
    } "dream" "dreamer" "erase" "eraser" public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        int index = S.length();
        boolean canDiv;
        while (true) {
            boolean isFit = false;
            for (String d: divide) {
                if (d.length() > index) continue;
                String substr = S.substring(index - d.length(), index);
                if (d.equals(substr)) {
                    index -= d.length();
                    isFit = true;
                    break;
                }
            }
            if (!isFit) {
                canDiv = false;
                break;
            }
            if (index == 0) {
                canDiv = true;
                break;
            }
        }

        if (canDiv)
            System.out.println("YES");
        else
            System.out.println("NO");
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        int index = S.length();
        boolean canDiv;
        while (true) {
            boolean isFit = false;
            for (String d: divide) {
                if (d.length() > index) continue;
                String substr = S.substring(index - d.length(), index);
                if (d.equals(substr)) {
                    index -= d.length();
                    isFit = true;
                    break;
                }
            }
            if (!isFit) {
                canDiv = false;
                break;
            }
            if (index == 0) {
                canDiv = true;
                break;
            }
        }

        if (canDiv)
            System.out.println("YES");
        else
            System.out.println("NO");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc int index = S.length(); index S.length() S.length S boolean canDiv; canDiv while (true) {
            boolean isFit = false;
            for (String d: divide) {
                if (d.length() > index) continue;
                String substr = S.substring(index - d.length(), index);
                if (d.equals(substr)) {
                    index -= d.length();
                    isFit = true;
                    break;
                }
            }
            if (!isFit) {
                canDiv = false;
                break;
            }
            if (index == 0) {
                canDiv = true;
                break;
            }
        } true {
            boolean isFit = false;
            for (String d: divide) {
                if (d.length() > index) continue;
                String substr = S.substring(index - d.length(), index);
                if (d.equals(substr)) {
                    index -= d.length();
                    isFit = true;
                    break;
                }
            }
            if (!isFit) {
                canDiv = false;
                break;
            }
            if (index == 0) {
                canDiv = true;
                break;
            }
        } boolean isFit = false; isFit false for (String d: divide) {
                if (d.length() > index) continue;
                String substr = S.substring(index - d.length(), index);
                if (d.equals(substr)) {
                    index -= d.length();
                    isFit = true;
                    break;
                }
            } String d divide {
                if (d.length() > index) continue;
                String substr = S.substring(index - d.length(), index);
                if (d.equals(substr)) {
                    index -= d.length();
                    isFit = true;
                    break;
                }
            } {
                if (d.length() > index) continue;
                String substr = S.substring(index - d.length(), index);
                if (d.equals(substr)) {
                    index -= d.length();
                    isFit = true;
                    break;
                }
            } if (d.length() > index) continue; d.length() > index d.length() d.length d index continue; String substr = S.substring(index - d.length(), index); substr S.substring(index - d.length(), index) S.substring S index - d.length() index d.length() d.length d index if (d.equals(substr)) {
                    index -= d.length();
                    isFit = true;
                    break;
                } d.equals(substr) d.equals d substr {
                    index -= d.length();
                    isFit = true;
                    break;
                } index -= d.length() index d.length() d.length d isFit = true isFit true break; if (!isFit) {
                canDiv = false;
                break;
            } !isFit isFit {
                canDiv = false;
                break;
            } canDiv = false canDiv false break; if (index == 0) {
                canDiv = true;
                break;
            } index == 0 index 0 {
                canDiv = true;
                break;
            } canDiv = true canDiv true break; if (canDiv)
            System.out.println("YES");
        else
            System.out.println("NO"); canDiv System.out.println("YES") System.out.println System.out System System.out "YES" System.out.println("NO") System.out.println System.out System System.out "NO" String args[] args
import java.util.*;

class Main {
    static String divide[] = {
        "dream",
        "dreamer",
        "erase",
        "eraser"
    };

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

        int index = S.length();
        boolean canDiv;
        while (true) {
            boolean isFit = false;
            for (String d: divide) {
                if (d.length() > index) continue;
                String substr = S.substring(index - d.length(), index);
                if (d.equals(substr)) {
                    index -= d.length();
                    isFit = true;
                    break;
                }
            }
            if (!isFit) {
                canDiv = false;
                break;
            }
            if (index == 0) {
                canDiv = true;
                break;
            }
        }

        if (canDiv)
            System.out.println("YES");
        else
            System.out.println("NO");
    }
}
