import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            String s = in.next();

            StringBuilder sb = new StringBuilder();
            sb.append(s);

            while (sb.length() > 0) {
                if (sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("dream")) {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                }
                if (sb.length() >= 7 && sb.substring(sb.length() - 7, sb.length()).equals("dreamer")) {
                    sb.delete(sb.length() - 7, sb.length());
                    continue;
                }
                if (sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("erase")) {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                }
                if (sb.length() >= 6 && sb.substring(sb.length() - 6, sb.length()).equals("eraser")) {
                    sb.delete(sb.length() - 6, sb.length());
                    continue;
                }
                out.println("NO");
                return;
            }
            out.println("YES");
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isPrintableChar(int c) {
            return c >= 33 && c <= 126;
        }

        public String next() {
            StringBuilder sb = new StringBuilder();

            int b = readByte();
            while (!isPrintableChar(b))
                b = readByte();

            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }

            return sb.toString();
        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.InputMismatchException; InputMismatchException java.util import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            String s = in.next();

            StringBuilder sb = new StringBuilder();
            sb.append(s);

            while (sb.length() > 0) {
                if (sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("dream")) {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                }
                if (sb.length() >= 7 && sb.substring(sb.length() - 7, sb.length()).equals("dreamer")) {
                    sb.delete(sb.length() - 7, sb.length());
                    continue;
                }
                if (sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("erase")) {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                }
                if (sb.length() >= 6 && sb.substring(sb.length() - 6, sb.length()).equals("eraser")) {
                    sb.delete(sb.length() - 6, sb.length());
                    continue;
                }
                out.println("NO");
                return;
            }
            out.println("YES");
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isPrintableChar(int c) {
            return c >= 33 && c <= 126;
        }

        public String next() {
            StringBuilder sb = new StringBuilder();

            int b = readByte();
            while (!isPrintableChar(b))
                b = readByte();

            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }

            return sb.toString();
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out FastScanner in = new FastScanner(inputStream); in new FastScanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) TaskC solver = new TaskC(); solver new TaskC() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class TaskC {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            String s = in.next();

            StringBuilder sb = new StringBuilder();
            sb.append(s);

            while (sb.length() > 0) {
                if (sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("dream")) {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                }
                if (sb.length() >= 7 && sb.substring(sb.length() - 7, sb.length()).equals("dreamer")) {
                    sb.delete(sb.length() - 7, sb.length());
                    continue;
                }
                if (sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("erase")) {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                }
                if (sb.length() >= 6 && sb.substring(sb.length() - 6, sb.length()).equals("eraser")) {
                    sb.delete(sb.length() - 6, sb.length());
                    continue;
                }
                out.println("NO");
                return;
            }
            out.println("YES");
        }

    } TaskC public void solve(int testNumber, FastScanner in, PrintWriter out) {
            String s = in.next();

            StringBuilder sb = new StringBuilder();
            sb.append(s);

            while (sb.length() > 0) {
                if (sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("dream")) {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                }
                if (sb.length() >= 7 && sb.substring(sb.length() - 7, sb.length()).equals("dreamer")) {
                    sb.delete(sb.length() - 7, sb.length());
                    continue;
                }
                if (sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("erase")) {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                }
                if (sb.length() >= 6 && sb.substring(sb.length() - 6, sb.length()).equals("eraser")) {
                    sb.delete(sb.length() - 6, sb.length());
                    continue;
                }
                out.println("NO");
                return;
            }
            out.println("YES");
        } solve {
            String s = in.next();

            StringBuilder sb = new StringBuilder();
            sb.append(s);

            while (sb.length() > 0) {
                if (sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("dream")) {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                }
                if (sb.length() >= 7 && sb.substring(sb.length() - 7, sb.length()).equals("dreamer")) {
                    sb.delete(sb.length() - 7, sb.length());
                    continue;
                }
                if (sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("erase")) {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                }
                if (sb.length() >= 6 && sb.substring(sb.length() - 6, sb.length()).equals("eraser")) {
                    sb.delete(sb.length() - 6, sb.length());
                    continue;
                }
                out.println("NO");
                return;
            }
            out.println("YES");
        } String s = in.next(); s in.next() in.next in StringBuilder sb = new StringBuilder(); sb new StringBuilder() sb.append(s) sb.append sb s while (sb.length() > 0) {
                if (sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("dream")) {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                }
                if (sb.length() >= 7 && sb.substring(sb.length() - 7, sb.length()).equals("dreamer")) {
                    sb.delete(sb.length() - 7, sb.length());
                    continue;
                }
                if (sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("erase")) {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                }
                if (sb.length() >= 6 && sb.substring(sb.length() - 6, sb.length()).equals("eraser")) {
                    sb.delete(sb.length() - 6, sb.length());
                    continue;
                }
                out.println("NO");
                return;
            } sb.length() > 0 sb.length() sb.length sb 0 {
                if (sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("dream")) {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                }
                if (sb.length() >= 7 && sb.substring(sb.length() - 7, sb.length()).equals("dreamer")) {
                    sb.delete(sb.length() - 7, sb.length());
                    continue;
                }
                if (sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("erase")) {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                }
                if (sb.length() >= 6 && sb.substring(sb.length() - 6, sb.length()).equals("eraser")) {
                    sb.delete(sb.length() - 6, sb.length());
                    continue;
                }
                out.println("NO");
                return;
            } if (sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("dream")) {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                } sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("dream") sb.length() >= 5 sb.length() sb.length sb 5 sb.substring(sb.length() - 5, sb.length()).equals("dream") sb.substring(sb.length() - 5, sb.length()).equals sb.substring(sb.length() - 5, sb.length()) sb.substring sb sb.length() - 5 sb.length() sb.length sb 5 sb.length() sb.length sb "dream" {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                } sb.delete(sb.length() - 5, sb.length()) sb.delete sb sb.length() - 5 sb.length() sb.length sb 5 sb.length() sb.length sb continue; if (sb.length() >= 7 && sb.substring(sb.length() - 7, sb.length()).equals("dreamer")) {
                    sb.delete(sb.length() - 7, sb.length());
                    continue;
                } sb.length() >= 7 && sb.substring(sb.length() - 7, sb.length()).equals("dreamer") sb.length() >= 7 sb.length() sb.length sb 7 sb.substring(sb.length() - 7, sb.length()).equals("dreamer") sb.substring(sb.length() - 7, sb.length()).equals sb.substring(sb.length() - 7, sb.length()) sb.substring sb sb.length() - 7 sb.length() sb.length sb 7 sb.length() sb.length sb "dreamer" {
                    sb.delete(sb.length() - 7, sb.length());
                    continue;
                } sb.delete(sb.length() - 7, sb.length()) sb.delete sb sb.length() - 7 sb.length() sb.length sb 7 sb.length() sb.length sb continue; if (sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("erase")) {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                } sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("erase") sb.length() >= 5 sb.length() sb.length sb 5 sb.substring(sb.length() - 5, sb.length()).equals("erase") sb.substring(sb.length() - 5, sb.length()).equals sb.substring(sb.length() - 5, sb.length()) sb.substring sb sb.length() - 5 sb.length() sb.length sb 5 sb.length() sb.length sb "erase" {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                } sb.delete(sb.length() - 5, sb.length()) sb.delete sb sb.length() - 5 sb.length() sb.length sb 5 sb.length() sb.length sb continue; if (sb.length() >= 6 && sb.substring(sb.length() - 6, sb.length()).equals("eraser")) {
                    sb.delete(sb.length() - 6, sb.length());
                    continue;
                } sb.length() >= 6 && sb.substring(sb.length() - 6, sb.length()).equals("eraser") sb.length() >= 6 sb.length() sb.length sb 6 sb.substring(sb.length() - 6, sb.length()).equals("eraser") sb.substring(sb.length() - 6, sb.length()).equals sb.substring(sb.length() - 6, sb.length()) sb.substring sb sb.length() - 6 sb.length() sb.length sb 6 sb.length() sb.length sb "eraser" {
                    sb.delete(sb.length() - 6, sb.length());
                    continue;
                } sb.delete(sb.length() - 6, sb.length()) sb.delete sb sb.length() - 6 sb.length() sb.length sb 6 sb.length() sb.length sb continue; out.println("NO") out.println out "NO" return; out.println("YES") out.println out "YES" int testNumber testNumber FastScanner in in PrintWriter out out static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isPrintableChar(int c) {
            return c >= 33 && c <= 126;
        }

        public String next() {
            StringBuilder sb = new StringBuilder();

            int b = readByte();
            while (!isPrintableChar(b))
                b = readByte();

            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }

            return sb.toString();
        }

    } FastScanner private InputStream in; in private byte[] buffer = new byte[1024]; buffer new byte[1024] 1024 private int bufPointer; bufPointer private int bufLength; bufLength public FastScanner(InputStream in) {
            this.in = in;
        } FastScanner {
            this.in = in;
        } this.in = in this.in this this.in in InputStream in in private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        } readByte {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        } if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            } bufPointer >= bufLength bufPointer bufLength {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            } if (bufLength == -1)
                    throw new InputMismatchException(); bufLength == -1 bufLength -1 1 throw new InputMismatchException(); new InputMismatchException() bufPointer = 0 bufPointer 0 try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                } catch (IOException e) {
                    throw new InputMismatchException();
                } IOException e {
                    throw new InputMismatchException();
                } throw new InputMismatchException(); new InputMismatchException() {
                    bufLength = in.read(buffer);
                } bufLength = in.read(buffer) bufLength in.read(buffer) in.read in buffer if (bufLength <= 0)
                    return -1; bufLength <= 0 bufLength 0 return -1; -1 1 return buffer[bufPointer++]; buffer[bufPointer++] buffer bufPointer++ bufPointer private static boolean isPrintableChar(int c) {
            return c >= 33 && c <= 126;
        } isPrintableChar {
            return c >= 33 && c <= 126;
        } return c >= 33 && c <= 126; c >= 33 && c <= 126 c >= 33 c 33 c <= 126 c 126 int c c public String next() {
            StringBuilder sb = new StringBuilder();

            int b = readByte();
            while (!isPrintableChar(b))
                b = readByte();

            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }

            return sb.toString();
        } next {
            StringBuilder sb = new StringBuilder();

            int b = readByte();
            while (!isPrintableChar(b))
                b = readByte();

            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }

            return sb.toString();
        } StringBuilder sb = new StringBuilder(); sb new StringBuilder() int b = readByte(); b readByte() readByte while (!isPrintableChar(b))
                b = readByte(); !isPrintableChar(b) isPrintableChar(b) isPrintableChar b b = readByte() b readByte() readByte while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            } isPrintableChar(b) isPrintableChar b {
                sb.appendCodePoint(b);
                b = readByte();
            } sb.appendCodePoint(b) sb.appendCodePoint sb b b = readByte() b readByte() readByte return sb.toString(); sb.toString() sb.toString sb public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            String s = in.next();

            StringBuilder sb = new StringBuilder();
            sb.append(s);

            while (sb.length() > 0) {
                if (sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("dream")) {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                }
                if (sb.length() >= 7 && sb.substring(sb.length() - 7, sb.length()).equals("dreamer")) {
                    sb.delete(sb.length() - 7, sb.length());
                    continue;
                }
                if (sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("erase")) {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                }
                if (sb.length() >= 6 && sb.substring(sb.length() - 6, sb.length()).equals("eraser")) {
                    sb.delete(sb.length() - 6, sb.length());
                    continue;
                }
                out.println("NO");
                return;
            }
            out.println("YES");
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isPrintableChar(int c) {
            return c >= 33 && c <= 126;
        }

        public String next() {
            StringBuilder sb = new StringBuilder();

            int b = readByte();
            while (!isPrintableChar(b))
                b = readByte();

            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }

            return sb.toString();
        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            String s = in.next();

            StringBuilder sb = new StringBuilder();
            sb.append(s);

            while (sb.length() > 0) {
                if (sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("dream")) {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                }
                if (sb.length() >= 7 && sb.substring(sb.length() - 7, sb.length()).equals("dreamer")) {
                    sb.delete(sb.length() - 7, sb.length());
                    continue;
                }
                if (sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("erase")) {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                }
                if (sb.length() >= 6 && sb.substring(sb.length() - 6, sb.length()).equals("eraser")) {
                    sb.delete(sb.length() - 6, sb.length());
                    continue;
                }
                out.println("NO");
                return;
            }
            out.println("YES");
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isPrintableChar(int c) {
            return c >= 33 && c <= 126;
        }

        public String next() {
            StringBuilder sb = new StringBuilder();

            int b = readByte();
            while (!isPrintableChar(b))
                b = readByte();

            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }

            return sb.toString();
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            String s = in.next();

            StringBuilder sb = new StringBuilder();
            sb.append(s);

            while (sb.length() > 0) {
                if (sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("dream")) {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                }
                if (sb.length() >= 7 && sb.substring(sb.length() - 7, sb.length()).equals("dreamer")) {
                    sb.delete(sb.length() - 7, sb.length());
                    continue;
                }
                if (sb.length() >= 5 && sb.substring(sb.length() - 5, sb.length()).equals("erase")) {
                    sb.delete(sb.length() - 5, sb.length());
                    continue;
                }
                if (sb.length() >= 6 && sb.substring(sb.length() - 6, sb.length()).equals("eraser")) {
                    sb.delete(sb.length() - 6, sb.length());
                    continue;
                }
                out.println("NO");
                return;
            }
            out.println("YES");
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isPrintableChar(int c) {
            return c >= 33 && c <= 126;
        }

        public String next() {
            StringBuilder sb = new StringBuilder();

            int b = readByte();
            while (!isPrintableChar(b))
                b = readByte();

            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }

            return sb.toString();
        }

    }
}

