import java.util.*;

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

        String[] words = {"dream", "dreamer", "erase", "eraser"};

        int len = S.length();
        while (len > 0) {
            boolean found = false;
            for (String word : words) {
                if (len < word.length()) {
                    continue;
                }
                String w = S.substring(len - word.length(), len);
                if (w.equals(word)) {
                    len -= w.length();
                    found = true;
                }
            }
            if (!found) {
                break;
            }
        }

        if (len == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        String S = cin.next();

        String[] words = {"dream", "dreamer", "erase", "eraser"};

        int len = S.length();
        while (len > 0) {
            boolean found = false;
            for (String word : words) {
                if (len < word.length()) {
                    continue;
                }
                String w = S.substring(len - word.length(), len);
                if (w.equals(word)) {
                    len -= w.length();
                    found = true;
                }
            }
            if (!found) {
                break;
            }
        }

        if (len == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} Main public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        String S = cin.next();

        String[] words = {"dream", "dreamer", "erase", "eraser"};

        int len = S.length();
        while (len > 0) {
            boolean found = false;
            for (String word : words) {
                if (len < word.length()) {
                    continue;
                }
                String w = S.substring(len - word.length(), len);
                if (w.equals(word)) {
                    len -= w.length();
                    found = true;
                }
            }
            if (!found) {
                break;
            }
        }

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

        String[] words = {"dream", "dreamer", "erase", "eraser"};

        int len = S.length();
        while (len > 0) {
            boolean found = false;
            for (String word : words) {
                if (len < word.length()) {
                    continue;
                }
                String w = S.substring(len - word.length(), len);
                if (w.equals(word)) {
                    len -= w.length();
                    found = true;
                }
            }
            if (!found) {
                break;
            }
        }

        if (len == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    } Scanner cin = new Scanner(System.in); cin new Scanner(System.in) String S = cin.next(); S cin.next() cin.next cin String[] words = {"dream", "dreamer", "erase", "eraser"}; words {"dream", "dreamer", "erase", "eraser"} "dream" "dreamer" "erase" "eraser" int len = S.length(); len S.length() S.length S while (len > 0) {
            boolean found = false;
            for (String word : words) {
                if (len < word.length()) {
                    continue;
                }
                String w = S.substring(len - word.length(), len);
                if (w.equals(word)) {
                    len -= w.length();
                    found = true;
                }
            }
            if (!found) {
                break;
            }
        } len > 0 len 0 {
            boolean found = false;
            for (String word : words) {
                if (len < word.length()) {
                    continue;
                }
                String w = S.substring(len - word.length(), len);
                if (w.equals(word)) {
                    len -= w.length();
                    found = true;
                }
            }
            if (!found) {
                break;
            }
        } boolean found = false; found false for (String word : words) {
                if (len < word.length()) {
                    continue;
                }
                String w = S.substring(len - word.length(), len);
                if (w.equals(word)) {
                    len -= w.length();
                    found = true;
                }
            } String word words {
                if (len < word.length()) {
                    continue;
                }
                String w = S.substring(len - word.length(), len);
                if (w.equals(word)) {
                    len -= w.length();
                    found = true;
                }
            } {
                if (len < word.length()) {
                    continue;
                }
                String w = S.substring(len - word.length(), len);
                if (w.equals(word)) {
                    len -= w.length();
                    found = true;
                }
            } if (len < word.length()) {
                    continue;
                } len < word.length() len word.length() word.length word {
                    continue;
                } continue; String w = S.substring(len - word.length(), len); w S.substring(len - word.length(), len) S.substring S len - word.length() len word.length() word.length word len if (w.equals(word)) {
                    len -= w.length();
                    found = true;
                } w.equals(word) w.equals w word {
                    len -= w.length();
                    found = true;
                } len -= w.length() len w.length() w.length w found = true found true if (!found) {
                break;
            } !found found {
                break;
            } break; if (len == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        } len == 0 len 0 {
            System.out.println("YES");
        } System.out.println("YES") System.out.println System.out System System.out "YES" {
            System.out.println("NO");
        } System.out.println("NO") System.out.println System.out System System.out "NO" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        String S = cin.next();

        String[] words = {"dream", "dreamer", "erase", "eraser"};

        int len = S.length();
        while (len > 0) {
            boolean found = false;
            for (String word : words) {
                if (len < word.length()) {
                    continue;
                }
                String w = S.substring(len - word.length(), len);
                if (w.equals(word)) {
                    len -= w.length();
                    found = true;
                }
            }
            if (!found) {
                break;
            }
        }

        if (len == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        String S = cin.next();

        String[] words = {"dream", "dreamer", "erase", "eraser"};

        int len = S.length();
        while (len > 0) {
            boolean found = false;
            for (String word : words) {
                if (len < word.length()) {
                    continue;
                }
                String w = S.substring(len - word.length(), len);
                if (w.equals(word)) {
                    len -= w.length();
                    found = true;
                }
            }
            if (!found) {
                break;
            }
        }

        if (len == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} Main
import java.util.*;

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

        String[] words = {"dream", "dreamer", "erase", "eraser"};

        int len = S.length();
        while (len > 0) {
            boolean found = false;
            for (String word : words) {
                if (len < word.length()) {
                    continue;
                }
                String w = S.substring(len - word.length(), len);
                if (w.equals(word)) {
                    len -= w.length();
                    found = true;
                }
            }
            if (!found) {
                break;
            }
        }

        if (len == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}