
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String lis[] = {
            "dream", "dreamer", "erase", "eraser"
        };
        int slen = s.length();
        
        while (true) {
            if (slen == 0) {
                System.out.println("YES");
                return;
            }
            boolean updated = false;
            for (int i = 0; i < 4; ++i) {
                String k = lis[i];
                if (slen >= k.length()) { //  && s.substring(s.length() - k.length(), s.length()).equals(k)) {
                    boolean ok = true;
                    for (int j = k.length() - 1; j >= 0; --j) {
                        if (k.charAt(j) == s.charAt(slen - k.length() + j)) {
                            // ok
                        } else {
                            ok = false;
                            break;
                        }
                    }
                    if (ok) {
                        slen = slen - k.length();
                        updated = true;
                        break;
                    }
                } else {
                    continue;
                }
            }
            if (!updated) {
                System.out.println("NO");
                return;
            }
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String lis[] = {
            "dream", "dreamer", "erase", "eraser"
        };
        int slen = s.length();
        
        while (true) {
            if (slen == 0) {
                System.out.println("YES");
                return;
            }
            boolean updated = false;
            for (int i = 0; i < 4; ++i) {
                String k = lis[i];
                if (slen >= k.length()) { //  && s.substring(s.length() - k.length(), s.length()).equals(k)) {
                    boolean ok = true;
                    for (int j = k.length() - 1; j >= 0; --j) {
                        if (k.charAt(j) == s.charAt(slen - k.length() + j)) {
                            // ok
                        } else {
                            ok = false;
                            break;
                        }
                    }
                    if (ok) {
                        slen = slen - k.length();
                        updated = true;
                        break;
                    }
                } else {
                    continue;
                }
            }
            if (!updated) {
                System.out.println("NO");
                return;
            }
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String lis[] = {
            "dream", "dreamer", "erase", "eraser"
        };
        int slen = s.length();
        
        while (true) {
            if (slen == 0) {
                System.out.println("YES");
                return;
            }
            boolean updated = false;
            for (int i = 0; i < 4; ++i) {
                String k = lis[i];
                if (slen >= k.length()) { //  && s.substring(s.length() - k.length(), s.length()).equals(k)) {
                    boolean ok = true;
                    for (int j = k.length() - 1; j >= 0; --j) {
                        if (k.charAt(j) == s.charAt(slen - k.length() + j)) {
                            // ok
                        } else {
                            ok = false;
                            break;
                        }
                    }
                    if (ok) {
                        slen = slen - k.length();
                        updated = true;
                        break;
                    }
                } else {
                    continue;
                }
            }
            if (!updated) {
                System.out.println("NO");
                return;
            }
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String lis[] = {
            "dream", "dreamer", "erase", "eraser"
        };
        int slen = s.length();
        
        while (true) {
            if (slen == 0) {
                System.out.println("YES");
                return;
            }
            boolean updated = false;
            for (int i = 0; i < 4; ++i) {
                String k = lis[i];
                if (slen >= k.length()) { //  && s.substring(s.length() - k.length(), s.length()).equals(k)) {
                    boolean ok = true;
                    for (int j = k.length() - 1; j >= 0; --j) {
                        if (k.charAt(j) == s.charAt(slen - k.length() + j)) {
                            // ok
                        } else {
                            ok = false;
                            break;
                        }
                    }
                    if (ok) {
                        slen = slen - k.length();
                        updated = true;
                        break;
                    }
                } else {
                    continue;
                }
            }
            if (!updated) {
                System.out.println("NO");
                return;
            }
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String lis[] = {
            "dream", "dreamer", "erase", "eraser"
        }; lis {
            "dream", "dreamer", "erase", "eraser"
        } "dream" "dreamer" "erase" "eraser" int slen = s.length(); slen s.length() s.length s while (true) {
            if (slen == 0) {
                System.out.println("YES");
                return;
            }
            boolean updated = false;
            for (int i = 0; i < 4; ++i) {
                String k = lis[i];
                if (slen >= k.length()) { //  && s.substring(s.length() - k.length(), s.length()).equals(k)) {
                    boolean ok = true;
                    for (int j = k.length() - 1; j >= 0; --j) {
                        if (k.charAt(j) == s.charAt(slen - k.length() + j)) {
                            // ok
                        } else {
                            ok = false;
                            break;
                        }
                    }
                    if (ok) {
                        slen = slen - k.length();
                        updated = true;
                        break;
                    }
                } else {
                    continue;
                }
            }
            if (!updated) {
                System.out.println("NO");
                return;
            }
        } true {
            if (slen == 0) {
                System.out.println("YES");
                return;
            }
            boolean updated = false;
            for (int i = 0; i < 4; ++i) {
                String k = lis[i];
                if (slen >= k.length()) { //  && s.substring(s.length() - k.length(), s.length()).equals(k)) {
                    boolean ok = true;
                    for (int j = k.length() - 1; j >= 0; --j) {
                        if (k.charAt(j) == s.charAt(slen - k.length() + j)) {
                            // ok
                        } else {
                            ok = false;
                            break;
                        }
                    }
                    if (ok) {
                        slen = slen - k.length();
                        updated = true;
                        break;
                    }
                } else {
                    continue;
                }
            }
            if (!updated) {
                System.out.println("NO");
                return;
            }
        } if (slen == 0) {
                System.out.println("YES");
                return;
            } slen == 0 slen 0 {
                System.out.println("YES");
                return;
            } System.out.println("YES") System.out.println System.out System System.out "YES" return; boolean updated = false; updated false for (int i = 0; i < 4; ++i) {
                String k = lis[i];
                if (slen >= k.length()) { //  && s.substring(s.length() - k.length(), s.length()).equals(k)) {
                    boolean ok = true;
                    for (int j = k.length() - 1; j >= 0; --j) {
                        if (k.charAt(j) == s.charAt(slen - k.length() + j)) {
                            // ok
                        } else {
                            ok = false;
                            break;
                        }
                    }
                    if (ok) {
                        slen = slen - k.length();
                        updated = true;
                        break;
                    }
                } else {
                    continue;
                }
            } int i = 0; int i = 0; i 0 i < 4 i 4 ++i ++i i {
                String k = lis[i];
                if (slen >= k.length()) { //  && s.substring(s.length() - k.length(), s.length()).equals(k)) {
                    boolean ok = true;
                    for (int j = k.length() - 1; j >= 0; --j) {
                        if (k.charAt(j) == s.charAt(slen - k.length() + j)) {
                            // ok
                        } else {
                            ok = false;
                            break;
                        }
                    }
                    if (ok) {
                        slen = slen - k.length();
                        updated = true;
                        break;
                    }
                } else {
                    continue;
                }
            } {
                String k = lis[i];
                if (slen >= k.length()) { //  && s.substring(s.length() - k.length(), s.length()).equals(k)) {
                    boolean ok = true;
                    for (int j = k.length() - 1; j >= 0; --j) {
                        if (k.charAt(j) == s.charAt(slen - k.length() + j)) {
                            // ok
                        } else {
                            ok = false;
                            break;
                        }
                    }
                    if (ok) {
                        slen = slen - k.length();
                        updated = true;
                        break;
                    }
                } else {
                    continue;
                }
            } String k = lis[i]; k lis[i] lis i if (slen >= k.length()) { //  && s.substring(s.length() - k.length(), s.length()).equals(k)) {
                    boolean ok = true;
                    for (int j = k.length() - 1; j >= 0; --j) {
                        if (k.charAt(j) == s.charAt(slen - k.length() + j)) {
                            // ok
                        } else {
                            ok = false;
                            break;
                        }
                    }
                    if (ok) {
                        slen = slen - k.length();
                        updated = true;
                        break;
                    }
                } else {
                    continue;
                } slen >= k.length() slen k.length() k.length k { //  && s.substring(s.length() - k.length(), s.length()).equals(k)) {
                    boolean ok = true;
                    for (int j = k.length() - 1; j >= 0; --j) {
                        if (k.charAt(j) == s.charAt(slen - k.length() + j)) {
                            // ok
                        } else {
                            ok = false;
                            break;
                        }
                    }
                    if (ok) {
                        slen = slen - k.length();
                        updated = true;
                        break;
                    }
                } boolean ok = true; ok true for (int j = k.length() - 1; j >= 0; --j) {
                        if (k.charAt(j) == s.charAt(slen - k.length() + j)) {
                            // ok
                        } else {
                            ok = false;
                            break;
                        }
                    } int j = k.length() - 1; int j = k.length() - 1; j k.length() - 1 k.length() k.length k 1 j >= 0 j 0 --j --j j {
                        if (k.charAt(j) == s.charAt(slen - k.length() + j)) {
                            // ok
                        } else {
                            ok = false;
                            break;
                        }
                    } {
                        if (k.charAt(j) == s.charAt(slen - k.length() + j)) {
                            // ok
                        } else {
                            ok = false;
                            break;
                        }
                    } if (k.charAt(j) == s.charAt(slen - k.length() + j)) {
                            // ok
                        } else {
                            ok = false;
                            break;
                        } k.charAt(j) == s.charAt(slen - k.length() + j) k.charAt(j) k.charAt k j s.charAt(slen - k.length() + j) s.charAt s slen - k.length() + j slen - k.length() slen k.length() k.length k j {
                            // ok
                        } {
                            ok = false;
                            break;
                        } ok = false ok false break; if (ok) {
                        slen = slen - k.length();
                        updated = true;
                        break;
                    } ok {
                        slen = slen - k.length();
                        updated = true;
                        break;
                    } slen = slen - k.length() slen slen - k.length() slen k.length() k.length k updated = true updated true break; {
                    continue;
                } continue; 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; String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String lis[] = {
            "dream", "dreamer", "erase", "eraser"
        };
        int slen = s.length();
        
        while (true) {
            if (slen == 0) {
                System.out.println("YES");
                return;
            }
            boolean updated = false;
            for (int i = 0; i < 4; ++i) {
                String k = lis[i];
                if (slen >= k.length()) { //  && s.substring(s.length() - k.length(), s.length()).equals(k)) {
                    boolean ok = true;
                    for (int j = k.length() - 1; j >= 0; --j) {
                        if (k.charAt(j) == s.charAt(slen - k.length() + j)) {
                            // ok
                        } else {
                            ok = false;
                            break;
                        }
                    }
                    if (ok) {
                        slen = slen - k.length();
                        updated = true;
                        break;
                    }
                } else {
                    continue;
                }
            }
            if (!updated) {
                System.out.println("NO");
                return;
            }
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String lis[] = {
            "dream", "dreamer", "erase", "eraser"
        };
        int slen = s.length();
        
        while (true) {
            if (slen == 0) {
                System.out.println("YES");
                return;
            }
            boolean updated = false;
            for (int i = 0; i < 4; ++i) {
                String k = lis[i];
                if (slen >= k.length()) { //  && s.substring(s.length() - k.length(), s.length()).equals(k)) {
                    boolean ok = true;
                    for (int j = k.length() - 1; j >= 0; --j) {
                        if (k.charAt(j) == s.charAt(slen - k.length() + j)) {
                            // ok
                        } else {
                            ok = false;
                            break;
                        }
                    }
                    if (ok) {
                        slen = slen - k.length();
                        updated = true;
                        break;
                    }
                } else {
                    continue;
                }
            }
            if (!updated) {
                System.out.println("NO");
                return;
            }
        }
    }
} Main

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String lis[] = {
            "dream", "dreamer", "erase", "eraser"
        };
        int slen = s.length();
        
        while (true) {
            if (slen == 0) {
                System.out.println("YES");
                return;
            }
            boolean updated = false;
            for (int i = 0; i < 4; ++i) {
                String k = lis[i];
                if (slen >= k.length()) { //  && s.substring(s.length() - k.length(), s.length()).equals(k)) {
                    boolean ok = true;
                    for (int j = k.length() - 1; j >= 0; --j) {
                        if (k.charAt(j) == s.charAt(slen - k.length() + j)) {
                            // ok
                        } else {
                            ok = false;
                            break;
                        }
                    }
                    if (ok) {
                        slen = slen - k.length();
                        updated = true;
                        break;
                    }
                } else {
                    continue;
                }
            }
            if (!updated) {
                System.out.println("NO");
                return;
            }
        }
    }
}
