import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = scan.next();
        StringBuilder current = new StringBuilder(s);
        for (int i = 0; i < 5 && current.length() > 0; i++) {
            current = remove(current, "eraser");
            current = remove(current, "erase");
            current = remove(current, "dreamer");
            current = remove(current, "dream");
        }
        System.out.println(current.length() == 0 ? "YES" : "NO");
    }
    private StringBuilder remove(StringBuilder sb, String search) {
        StringBuilder result = new StringBuilder();
        char[] d = search.toCharArray();
        int length = search.length();
        for (int i = 0; i < sb.length(); i++) {
            boolean ng = false;
            for (int j = 0; j < length; j++) {
                if (sb.length() <= i + j) {
                    ng = true;
                    break;
                }
                if (sb.charAt(i+j) != d[j]) {
                    ng = true;
                    break;
                }
            }
            if (!ng) {
                i = i + length - 1;
                continue;
            }
            result.append(sb.charAt(i));
        }
        return result;
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = scan.next();
        StringBuilder current = new StringBuilder(s);
        for (int i = 0; i < 5 && current.length() > 0; i++) {
            current = remove(current, "eraser");
            current = remove(current, "erase");
            current = remove(current, "dreamer");
            current = remove(current, "dream");
        }
        System.out.println(current.length() == 0 ? "YES" : "NO");
    }
    private StringBuilder remove(StringBuilder sb, String search) {
        StringBuilder result = new StringBuilder();
        char[] d = search.toCharArray();
        int length = search.length();
        for (int i = 0; i < sb.length(); i++) {
            boolean ng = false;
            for (int j = 0; j < length; j++) {
                if (sb.length() <= i + j) {
                    ng = true;
                    break;
                }
                if (sb.charAt(i+j) != d[j]) {
                    ng = true;
                    break;
                }
            }
            if (!ng) {
                i = i + length - 1;
                continue;
            }
            result.append(sb.charAt(i));
        }
        return result;
    }
} Main public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    } main {
        Main main = new Main();
        main.solve();
    } Main main = new Main(); main new Main() main.solve() main.solve main String[] args args public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = scan.next();
        StringBuilder current = new StringBuilder(s);
        for (int i = 0; i < 5 && current.length() > 0; i++) {
            current = remove(current, "eraser");
            current = remove(current, "erase");
            current = remove(current, "dreamer");
            current = remove(current, "dream");
        }
        System.out.println(current.length() == 0 ? "YES" : "NO");
    } solve {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = scan.next();
        StringBuilder current = new StringBuilder(s);
        for (int i = 0; i < 5 && current.length() > 0; i++) {
            current = remove(current, "eraser");
            current = remove(current, "erase");
            current = remove(current, "dreamer");
            current = remove(current, "dream");
        }
        System.out.println(current.length() == 0 ? "YES" : "NO");
    } Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in))); scan new Scanner(new BufferedReader(new InputStreamReader(System.in))) String s = scan.next(); s scan.next() scan.next scan StringBuilder current = new StringBuilder(s); current new StringBuilder(s) for (int i = 0; i < 5 && current.length() > 0; i++) {
            current = remove(current, "eraser");
            current = remove(current, "erase");
            current = remove(current, "dreamer");
            current = remove(current, "dream");
        } int i = 0; int i = 0; i 0 i < 5 && current.length() > 0 i < 5 i 5 current.length() > 0 current.length() current.length current 0 i++ i++ i {
            current = remove(current, "eraser");
            current = remove(current, "erase");
            current = remove(current, "dreamer");
            current = remove(current, "dream");
        } {
            current = remove(current, "eraser");
            current = remove(current, "erase");
            current = remove(current, "dreamer");
            current = remove(current, "dream");
        } current = remove(current, "eraser") current remove(current, "eraser") remove current "eraser" current = remove(current, "erase") current remove(current, "erase") remove current "erase" current = remove(current, "dreamer") current remove(current, "dreamer") remove current "dreamer" current = remove(current, "dream") current remove(current, "dream") remove current "dream" System.out.println(current.length() == 0 ? "YES" : "NO") System.out.println System.out System System.out current.length() == 0 ? "YES" : "NO" current.length() == 0 current.length() current.length current 0 "YES" "NO" private StringBuilder remove(StringBuilder sb, String search) {
        StringBuilder result = new StringBuilder();
        char[] d = search.toCharArray();
        int length = search.length();
        for (int i = 0; i < sb.length(); i++) {
            boolean ng = false;
            for (int j = 0; j < length; j++) {
                if (sb.length() <= i + j) {
                    ng = true;
                    break;
                }
                if (sb.charAt(i+j) != d[j]) {
                    ng = true;
                    break;
                }
            }
            if (!ng) {
                i = i + length - 1;
                continue;
            }
            result.append(sb.charAt(i));
        }
        return result;
    } remove {
        StringBuilder result = new StringBuilder();
        char[] d = search.toCharArray();
        int length = search.length();
        for (int i = 0; i < sb.length(); i++) {
            boolean ng = false;
            for (int j = 0; j < length; j++) {
                if (sb.length() <= i + j) {
                    ng = true;
                    break;
                }
                if (sb.charAt(i+j) != d[j]) {
                    ng = true;
                    break;
                }
            }
            if (!ng) {
                i = i + length - 1;
                continue;
            }
            result.append(sb.charAt(i));
        }
        return result;
    } StringBuilder result = new StringBuilder(); result new StringBuilder() char[] d = search.toCharArray(); d search.toCharArray() search.toCharArray search int length = search.length(); length search.length() search.length search for (int i = 0; i < sb.length(); i++) {
            boolean ng = false;
            for (int j = 0; j < length; j++) {
                if (sb.length() <= i + j) {
                    ng = true;
                    break;
                }
                if (sb.charAt(i+j) != d[j]) {
                    ng = true;
                    break;
                }
            }
            if (!ng) {
                i = i + length - 1;
                continue;
            }
            result.append(sb.charAt(i));
        } int i = 0; int i = 0; i 0 i < sb.length() i sb.length() sb.length sb i++ i++ i {
            boolean ng = false;
            for (int j = 0; j < length; j++) {
                if (sb.length() <= i + j) {
                    ng = true;
                    break;
                }
                if (sb.charAt(i+j) != d[j]) {
                    ng = true;
                    break;
                }
            }
            if (!ng) {
                i = i + length - 1;
                continue;
            }
            result.append(sb.charAt(i));
        } {
            boolean ng = false;
            for (int j = 0; j < length; j++) {
                if (sb.length() <= i + j) {
                    ng = true;
                    break;
                }
                if (sb.charAt(i+j) != d[j]) {
                    ng = true;
                    break;
                }
            }
            if (!ng) {
                i = i + length - 1;
                continue;
            }
            result.append(sb.charAt(i));
        } boolean ng = false; ng false for (int j = 0; j < length; j++) {
                if (sb.length() <= i + j) {
                    ng = true;
                    break;
                }
                if (sb.charAt(i+j) != d[j]) {
                    ng = true;
                    break;
                }
            } int j = 0; int j = 0; j 0 j < length j length j++ j++ j {
                if (sb.length() <= i + j) {
                    ng = true;
                    break;
                }
                if (sb.charAt(i+j) != d[j]) {
                    ng = true;
                    break;
                }
            } {
                if (sb.length() <= i + j) {
                    ng = true;
                    break;
                }
                if (sb.charAt(i+j) != d[j]) {
                    ng = true;
                    break;
                }
            } if (sb.length() <= i + j) {
                    ng = true;
                    break;
                } sb.length() <= i + j sb.length() sb.length sb i + j i j {
                    ng = true;
                    break;
                } ng = true ng true break; if (sb.charAt(i+j) != d[j]) {
                    ng = true;
                    break;
                } sb.charAt(i+j) != d[j] sb.charAt(i+j) sb.charAt sb i+j i j d[j] d j {
                    ng = true;
                    break;
                } ng = true ng true break; if (!ng) {
                i = i + length - 1;
                continue;
            } !ng ng {
                i = i + length - 1;
                continue;
            } i = i + length - 1 i i + length - 1 i + length i length 1 continue; result.append(sb.charAt(i)) result.append result sb.charAt(i) sb.charAt sb i return result; result StringBuilder sb sb String search search public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = scan.next();
        StringBuilder current = new StringBuilder(s);
        for (int i = 0; i < 5 && current.length() > 0; i++) {
            current = remove(current, "eraser");
            current = remove(current, "erase");
            current = remove(current, "dreamer");
            current = remove(current, "dream");
        }
        System.out.println(current.length() == 0 ? "YES" : "NO");
    }
    private StringBuilder remove(StringBuilder sb, String search) {
        StringBuilder result = new StringBuilder();
        char[] d = search.toCharArray();
        int length = search.length();
        for (int i = 0; i < sb.length(); i++) {
            boolean ng = false;
            for (int j = 0; j < length; j++) {
                if (sb.length() <= i + j) {
                    ng = true;
                    break;
                }
                if (sb.charAt(i+j) != d[j]) {
                    ng = true;
                    break;
                }
            }
            if (!ng) {
                i = i + length - 1;
                continue;
            }
            result.append(sb.charAt(i));
        }
        return result;
    }
} public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = scan.next();
        StringBuilder current = new StringBuilder(s);
        for (int i = 0; i < 5 && current.length() > 0; i++) {
            current = remove(current, "eraser");
            current = remove(current, "erase");
            current = remove(current, "dreamer");
            current = remove(current, "dream");
        }
        System.out.println(current.length() == 0 ? "YES" : "NO");
    }
    private StringBuilder remove(StringBuilder sb, String search) {
        StringBuilder result = new StringBuilder();
        char[] d = search.toCharArray();
        int length = search.length();
        for (int i = 0; i < sb.length(); i++) {
            boolean ng = false;
            for (int j = 0; j < length; j++) {
                if (sb.length() <= i + j) {
                    ng = true;
                    break;
                }
                if (sb.charAt(i+j) != d[j]) {
                    ng = true;
                    break;
                }
            }
            if (!ng) {
                i = i + length - 1;
                continue;
            }
            result.append(sb.charAt(i));
        }
        return result;
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = scan.next();
        StringBuilder current = new StringBuilder(s);
        for (int i = 0; i < 5 && current.length() > 0; i++) {
            current = remove(current, "eraser");
            current = remove(current, "erase");
            current = remove(current, "dreamer");
            current = remove(current, "dream");
        }
        System.out.println(current.length() == 0 ? "YES" : "NO");
    }
    private StringBuilder remove(StringBuilder sb, String search) {
        StringBuilder result = new StringBuilder();
        char[] d = search.toCharArray();
        int length = search.length();
        for (int i = 0; i < sb.length(); i++) {
            boolean ng = false;
            for (int j = 0; j < length; j++) {
                if (sb.length() <= i + j) {
                    ng = true;
                    break;
                }
                if (sb.charAt(i+j) != d[j]) {
                    ng = true;
                    break;
                }
            }
            if (!ng) {
                i = i + length - 1;
                continue;
            }
            result.append(sb.charAt(i));
        }
        return result;
    }
}
