

/**
 * @Author Mehdi Maick
 * Created on 10/12/2016.
 */

import java.util.*;
import java.io.*;

import static java.lang.Math.*;

public class Main {


    public static void solve(FastReader fs, PrintWriter pw) {
        char[] s = fs.next().toCharArray();
        boolean[] f = new boolean[s.length + 1];
        f[0] = true;
        for (int i = 1; i <= s.length; i++) {
            if (i >= 5) {
                if (s[i - 1] == 'm' && s[i - 2] == 'a' && s[i - 3] == 'e' && s[i - 4] == 'r' && s[i - 5] == 'd') {
                    f[i] |= f[i - 5];
//                    System.err.println("found dream");
                    if (i + 1 < s.length && s[i] == 'e' && s[i + 1] == 'r') {
                        f[i + 2] |= f[i];
//                        System.err.println("found dreamer");
                    }

                } else if (s[i - 1] == 'e' && s[i - 2] == 's' && s[i - 3] == 'a' && s[i - 4] == 'r' && s[i - 5] == 'e') {
                    f[i] |= f[i - 5];
//                    System.err.println("found ERASE");
                    if (i < s.length && s[i] == 'r') {
                        f[i + 1] |= f[i];
//                        System.err.println("found dreamer");
                    }

                }


            }
        }
//        pw.println(Arrays.toString(f));
        pw.println((f[s.length] ? "YES" : "NO"));

    }

    public static void main(String[] args) throws Exception {
        FastReader fs = new FastReader(System.in);
        PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));

        solve(fs, pw);

        fs.close();
        pw.close();
    }

    static class FastReader {

        BufferedReader reader;
        StringTokenizer st;

        FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            String s = null;
            try {
                s = reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return next().charAt(0);
        }

        int[] nextIntArray(int n) {
            int[] arr = new int[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArray(int n) {
            long[] arr = new long[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        int[] nextIntArrayOneBased(int n) {
            int[] arr = new int[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArrayOneBased(int n) {
            long[] arr = new long[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        void close() {
            try {
                reader.close();
            } catch (IOException e) {
                System.err.println("There's been an error trying closing the reader ");
                e.printStackTrace();
            }
        }
    }


} import java.util.*; util.* java import java.io.*; io.* java import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; public class Main {


    public static void solve(FastReader fs, PrintWriter pw) {
        char[] s = fs.next().toCharArray();
        boolean[] f = new boolean[s.length + 1];
        f[0] = true;
        for (int i = 1; i <= s.length; i++) {
            if (i >= 5) {
                if (s[i - 1] == 'm' && s[i - 2] == 'a' && s[i - 3] == 'e' && s[i - 4] == 'r' && s[i - 5] == 'd') {
                    f[i] |= f[i - 5];
//                    System.err.println("found dream");
                    if (i + 1 < s.length && s[i] == 'e' && s[i + 1] == 'r') {
                        f[i + 2] |= f[i];
//                        System.err.println("found dreamer");
                    }

                } else if (s[i - 1] == 'e' && s[i - 2] == 's' && s[i - 3] == 'a' && s[i - 4] == 'r' && s[i - 5] == 'e') {
                    f[i] |= f[i - 5];
//                    System.err.println("found ERASE");
                    if (i < s.length && s[i] == 'r') {
                        f[i + 1] |= f[i];
//                        System.err.println("found dreamer");
                    }

                }


            }
        }
//        pw.println(Arrays.toString(f));
        pw.println((f[s.length] ? "YES" : "NO"));

    }

    public static void main(String[] args) throws Exception {
        FastReader fs = new FastReader(System.in);
        PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));

        solve(fs, pw);

        fs.close();
        pw.close();
    }

    static class FastReader {

        BufferedReader reader;
        StringTokenizer st;

        FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            String s = null;
            try {
                s = reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return next().charAt(0);
        }

        int[] nextIntArray(int n) {
            int[] arr = new int[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArray(int n) {
            long[] arr = new long[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        int[] nextIntArrayOneBased(int n) {
            int[] arr = new int[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArrayOneBased(int n) {
            long[] arr = new long[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        void close() {
            try {
                reader.close();
            } catch (IOException e) {
                System.err.println("There's been an error trying closing the reader ");
                e.printStackTrace();
            }
        }
    }


} Main public static void solve(FastReader fs, PrintWriter pw) {
        char[] s = fs.next().toCharArray();
        boolean[] f = new boolean[s.length + 1];
        f[0] = true;
        for (int i = 1; i <= s.length; i++) {
            if (i >= 5) {
                if (s[i - 1] == 'm' && s[i - 2] == 'a' && s[i - 3] == 'e' && s[i - 4] == 'r' && s[i - 5] == 'd') {
                    f[i] |= f[i - 5];
//                    System.err.println("found dream");
                    if (i + 1 < s.length && s[i] == 'e' && s[i + 1] == 'r') {
                        f[i + 2] |= f[i];
//                        System.err.println("found dreamer");
                    }

                } else if (s[i - 1] == 'e' && s[i - 2] == 's' && s[i - 3] == 'a' && s[i - 4] == 'r' && s[i - 5] == 'e') {
                    f[i] |= f[i - 5];
//                    System.err.println("found ERASE");
                    if (i < s.length && s[i] == 'r') {
                        f[i + 1] |= f[i];
//                        System.err.println("found dreamer");
                    }

                }


            }
        }
//        pw.println(Arrays.toString(f));
        pw.println((f[s.length] ? "YES" : "NO"));

    } solve {
        char[] s = fs.next().toCharArray();
        boolean[] f = new boolean[s.length + 1];
        f[0] = true;
        for (int i = 1; i <= s.length; i++) {
            if (i >= 5) {
                if (s[i - 1] == 'm' && s[i - 2] == 'a' && s[i - 3] == 'e' && s[i - 4] == 'r' && s[i - 5] == 'd') {
                    f[i] |= f[i - 5];
//                    System.err.println("found dream");
                    if (i + 1 < s.length && s[i] == 'e' && s[i + 1] == 'r') {
                        f[i + 2] |= f[i];
//                        System.err.println("found dreamer");
                    }

                } else if (s[i - 1] == 'e' && s[i - 2] == 's' && s[i - 3] == 'a' && s[i - 4] == 'r' && s[i - 5] == 'e') {
                    f[i] |= f[i - 5];
//                    System.err.println("found ERASE");
                    if (i < s.length && s[i] == 'r') {
                        f[i + 1] |= f[i];
//                        System.err.println("found dreamer");
                    }

                }


            }
        }
//        pw.println(Arrays.toString(f));
        pw.println((f[s.length] ? "YES" : "NO"));

    } char[] s = fs.next().toCharArray(); s fs.next().toCharArray() fs.next().toCharArray fs.next() fs.next fs boolean[] f = new boolean[s.length + 1]; f new boolean[s.length + 1] s.length + 1 s.length s s.length 1 f[0] = true f[0] f 0 true for (int i = 1; i <= s.length; i++) {
            if (i >= 5) {
                if (s[i - 1] == 'm' && s[i - 2] == 'a' && s[i - 3] == 'e' && s[i - 4] == 'r' && s[i - 5] == 'd') {
                    f[i] |= f[i - 5];
//                    System.err.println("found dream");
                    if (i + 1 < s.length && s[i] == 'e' && s[i + 1] == 'r') {
                        f[i + 2] |= f[i];
//                        System.err.println("found dreamer");
                    }

                } else if (s[i - 1] == 'e' && s[i - 2] == 's' && s[i - 3] == 'a' && s[i - 4] == 'r' && s[i - 5] == 'e') {
                    f[i] |= f[i - 5];
//                    System.err.println("found ERASE");
                    if (i < s.length && s[i] == 'r') {
                        f[i + 1] |= f[i];
//                        System.err.println("found dreamer");
                    }

                }


            }
        } int i = 1; int i = 1; i 1 i <= s.length i s.length s s.length i++ i++ i {
            if (i >= 5) {
                if (s[i - 1] == 'm' && s[i - 2] == 'a' && s[i - 3] == 'e' && s[i - 4] == 'r' && s[i - 5] == 'd') {
                    f[i] |= f[i - 5];
//                    System.err.println("found dream");
                    if (i + 1 < s.length && s[i] == 'e' && s[i + 1] == 'r') {
                        f[i + 2] |= f[i];
//                        System.err.println("found dreamer");
                    }

                } else if (s[i - 1] == 'e' && s[i - 2] == 's' && s[i - 3] == 'a' && s[i - 4] == 'r' && s[i - 5] == 'e') {
                    f[i] |= f[i - 5];
//                    System.err.println("found ERASE");
                    if (i < s.length && s[i] == 'r') {
                        f[i + 1] |= f[i];
//                        System.err.println("found dreamer");
                    }

                }


            }
        } {
            if (i >= 5) {
                if (s[i - 1] == 'm' && s[i - 2] == 'a' && s[i - 3] == 'e' && s[i - 4] == 'r' && s[i - 5] == 'd') {
                    f[i] |= f[i - 5];
//                    System.err.println("found dream");
                    if (i + 1 < s.length && s[i] == 'e' && s[i + 1] == 'r') {
                        f[i + 2] |= f[i];
//                        System.err.println("found dreamer");
                    }

                } else if (s[i - 1] == 'e' && s[i - 2] == 's' && s[i - 3] == 'a' && s[i - 4] == 'r' && s[i - 5] == 'e') {
                    f[i] |= f[i - 5];
//                    System.err.println("found ERASE");
                    if (i < s.length && s[i] == 'r') {
                        f[i + 1] |= f[i];
//                        System.err.println("found dreamer");
                    }

                }


            }
        } if (i >= 5) {
                if (s[i - 1] == 'm' && s[i - 2] == 'a' && s[i - 3] == 'e' && s[i - 4] == 'r' && s[i - 5] == 'd') {
                    f[i] |= f[i - 5];
//                    System.err.println("found dream");
                    if (i + 1 < s.length && s[i] == 'e' && s[i + 1] == 'r') {
                        f[i + 2] |= f[i];
//                        System.err.println("found dreamer");
                    }

                } else if (s[i - 1] == 'e' && s[i - 2] == 's' && s[i - 3] == 'a' && s[i - 4] == 'r' && s[i - 5] == 'e') {
                    f[i] |= f[i - 5];
//                    System.err.println("found ERASE");
                    if (i < s.length && s[i] == 'r') {
                        f[i + 1] |= f[i];
//                        System.err.println("found dreamer");
                    }

                }


            } i >= 5 i 5 {
                if (s[i - 1] == 'm' && s[i - 2] == 'a' && s[i - 3] == 'e' && s[i - 4] == 'r' && s[i - 5] == 'd') {
                    f[i] |= f[i - 5];
//                    System.err.println("found dream");
                    if (i + 1 < s.length && s[i] == 'e' && s[i + 1] == 'r') {
                        f[i + 2] |= f[i];
//                        System.err.println("found dreamer");
                    }

                } else if (s[i - 1] == 'e' && s[i - 2] == 's' && s[i - 3] == 'a' && s[i - 4] == 'r' && s[i - 5] == 'e') {
                    f[i] |= f[i - 5];
//                    System.err.println("found ERASE");
                    if (i < s.length && s[i] == 'r') {
                        f[i + 1] |= f[i];
//                        System.err.println("found dreamer");
                    }

                }


            } if (s[i - 1] == 'm' && s[i - 2] == 'a' && s[i - 3] == 'e' && s[i - 4] == 'r' && s[i - 5] == 'd') {
                    f[i] |= f[i - 5];
//                    System.err.println("found dream");
                    if (i + 1 < s.length && s[i] == 'e' && s[i + 1] == 'r') {
                        f[i + 2] |= f[i];
//                        System.err.println("found dreamer");
                    }

                } else if (s[i - 1] == 'e' && s[i - 2] == 's' && s[i - 3] == 'a' && s[i - 4] == 'r' && s[i - 5] == 'e') {
                    f[i] |= f[i - 5];
//                    System.err.println("found ERASE");
                    if (i < s.length && s[i] == 'r') {
                        f[i + 1] |= f[i];
//                        System.err.println("found dreamer");
                    }

                } s[i - 1] == 'm' && s[i - 2] == 'a' && s[i - 3] == 'e' && s[i - 4] == 'r' && s[i - 5] == 'd' s[i - 4] == 'r' s[i - 3] == 'e' s[i - 1] == 'm' && s[i - 2] == 'a' && s[i - 3] == 'e' && s[i - 4] == 'r' && s[i - 5] == 'd' s[i - 1] == 'm' s[i - 1] s i - 1 i 1 'm' s[i - 2] == 'a' s[i - 2] s i - 2 i 2 'a' s[i - 3] == 'e' s[i - 3] s i - 3 i 3 'e' s[i - 4] == 'r' s[i - 4] s i - 4 i 4 'r' s[i - 5] == 'd' s[i - 5] s i - 5 i 5 'd' {
                    f[i] |= f[i - 5];
//                    System.err.println("found dream");
                    if (i + 1 < s.length && s[i] == 'e' && s[i + 1] == 'r') {
                        f[i + 2] |= f[i];
//                        System.err.println("found dreamer");
                    }

                } f[i] |= f[i - 5] f[i] f i f[i - 5] f i - 5 i 5 if (i + 1 < s.length && s[i] == 'e' && s[i + 1] == 'r') {
                        f[i + 2] |= f[i];
//                        System.err.println("found dreamer");
                    } i + 1 < s.length && s[i] == 'e' && s[i + 1] == 'r' i + 1 < s.length && s[i] == 'e' && s[i + 1] == 'r' i + 1 < s.length i + 1 i 1 s.length s s.length s[i] == 'e' s[i] s i 'e' s[i + 1] == 'r' s[i + 1] s i + 1 i 1 'r' {
                        f[i + 2] |= f[i];
//                        System.err.println("found dreamer");
                    } f[i + 2] |= f[i] f[i + 2] f i + 2 i 2 f[i] f i if (s[i - 1] == 'e' && s[i - 2] == 's' && s[i - 3] == 'a' && s[i - 4] == 'r' && s[i - 5] == 'e') {
                    f[i] |= f[i - 5];
//                    System.err.println("found ERASE");
                    if (i < s.length && s[i] == 'r') {
                        f[i + 1] |= f[i];
//                        System.err.println("found dreamer");
                    }

                } s[i - 1] == 'e' && s[i - 2] == 's' && s[i - 3] == 'a' && s[i - 4] == 'r' && s[i - 5] == 'e' s[i - 4] == 'r' s[i - 3] == 'a' s[i - 1] == 'e' && s[i - 2] == 's' && s[i - 3] == 'a' && s[i - 4] == 'r' && s[i - 5] == 'e' s[i - 1] == 'e' s[i - 1] s i - 1 i 1 'e' s[i - 2] == 's' s[i - 2] s i - 2 i 2 's' s[i - 3] == 'a' s[i - 3] s i - 3 i 3 'a' s[i - 4] == 'r' s[i - 4] s i - 4 i 4 'r' s[i - 5] == 'e' s[i - 5] s i - 5 i 5 'e' {
                    f[i] |= f[i - 5];
//                    System.err.println("found ERASE");
                    if (i < s.length && s[i] == 'r') {
                        f[i + 1] |= f[i];
//                        System.err.println("found dreamer");
                    }

                } f[i] |= f[i - 5] f[i] f i f[i - 5] f i - 5 i 5 if (i < s.length && s[i] == 'r') {
                        f[i + 1] |= f[i];
//                        System.err.println("found dreamer");
                    } i < s.length && s[i] == 'r' i < s.length i s.length s s.length s[i] == 'r' s[i] s i 'r' {
                        f[i + 1] |= f[i];
//                        System.err.println("found dreamer");
                    } f[i + 1] |= f[i] f[i + 1] f i + 1 i 1 f[i] f i pw.println((f[s.length] ? "YES" : "NO")) pw.println pw (f[s.length] ? "YES" : "NO") f[s.length] f s.length s s.length "YES" "NO" FastReader fs fs PrintWriter pw pw public static void main(String[] args) throws Exception {
        FastReader fs = new FastReader(System.in);
        PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));

        solve(fs, pw);

        fs.close();
        pw.close();
    } main {
        FastReader fs = new FastReader(System.in);
        PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));

        solve(fs, pw);

        fs.close();
        pw.close();
    } FastReader fs = new FastReader(System.in); fs new FastReader(System.in) PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out)); pw new PrintWriter(new OutputStreamWriter(System.out)) solve(fs, pw) solve fs pw fs.close() fs.close fs pw.close() pw.close pw String[] args args static class FastReader {

        BufferedReader reader;
        StringTokenizer st;

        FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            String s = null;
            try {
                s = reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return next().charAt(0);
        }

        int[] nextIntArray(int n) {
            int[] arr = new int[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArray(int n) {
            long[] arr = new long[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        int[] nextIntArrayOneBased(int n) {
            int[] arr = new int[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArrayOneBased(int n) {
            long[] arr = new long[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        void close() {
            try {
                reader.close();
            } catch (IOException e) {
                System.err.println("There's been an error trying closing the reader ");
                e.printStackTrace();
            }
        }
    } FastReader BufferedReader reader; reader StringTokenizer st; st FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        } FastReader {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        } reader = new BufferedReader(new InputStreamReader(stream)) reader new BufferedReader(new InputStreamReader(stream)) st = null st null InputStream stream stream String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        } next {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        } while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            } st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            } try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                } catch (Exception e) {
                    throw new RuntimeException();
                } Exception e {
                    throw new RuntimeException();
                } throw new RuntimeException(); new RuntimeException() {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } String line = reader.readLine(); line reader.readLine() reader.readLine reader if (line == null) {
                        return null;
                    } line == null line null {
                        return null;
                    } return null; null st = new StringTokenizer(line) st new StringTokenizer(line) return st.nextToken(); st.nextToken() st.nextToken st String nextLine() {
            String s = null;
            try {
                s = reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        } nextLine {
            String s = null;
            try {
                s = reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        } String s = null; s null try {
                s = reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } IOException e {
                e.printStackTrace();
            } e.printStackTrace() e.printStackTrace e {
                s = reader.readLine();
            } s = reader.readLine() s reader.readLine() reader.readLine reader return s; s int nextInt() {
            return Integer.parseInt(next());
        } nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next long nextLong() {
            return Long.parseLong(next());
        } nextLong {
            return Long.parseLong(next());
        } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next double nextDouble() {
            return Double.parseDouble(next());
        } nextDouble {
            return Double.parseDouble(next());
        } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next char nextChar() {
            return next().charAt(0);
        } nextChar {
            return next().charAt(0);
        } return next().charAt(0); next().charAt(0) next().charAt next() next 0 int[] nextIntArray(int n) {
            int[] arr = new int[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextInt();
            }
            return arr;
        } nextIntArray {
            int[] arr = new int[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextInt();
            }
            return arr;
        } int[] arr = new int[n]; arr new int[n] n int i = 0; i 0 while (i < n) {
                arr[i++] = nextInt();
            } i < n i n {
                arr[i++] = nextInt();
            } arr[i++] = nextInt() arr[i++] arr i++ i nextInt() nextInt return arr; arr int n n long[] nextLongArray(int n) {
            long[] arr = new long[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextLong();
            }
            return arr;
        } nextLongArray {
            long[] arr = new long[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextLong();
            }
            return arr;
        } long[] arr = new long[n]; arr new long[n] n int i = 0; i 0 while (i < n) {
                arr[i++] = nextLong();
            } i < n i n {
                arr[i++] = nextLong();
            } arr[i++] = nextLong() arr[i++] arr i++ i nextLong() nextLong return arr; arr int n n int[] nextIntArrayOneBased(int n) {
            int[] arr = new int[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextInt();
            }
            return arr;
        } nextIntArrayOneBased {
            int[] arr = new int[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextInt();
            }
            return arr;
        } int[] arr = new int[n + 1]; arr new int[n + 1] n + 1 n 1 int i = 1; i 1 while (i <= n) {
                arr[i++] = nextInt();
            } i <= n i n {
                arr[i++] = nextInt();
            } arr[i++] = nextInt() arr[i++] arr i++ i nextInt() nextInt return arr; arr int n n long[] nextLongArrayOneBased(int n) {
            long[] arr = new long[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextLong();
            }
            return arr;
        } nextLongArrayOneBased {
            long[] arr = new long[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextLong();
            }
            return arr;
        } long[] arr = new long[n + 1]; arr new long[n + 1] n + 1 n 1 int i = 1; i 1 while (i <= n) {
                arr[i++] = nextLong();
            } i <= n i n {
                arr[i++] = nextLong();
            } arr[i++] = nextLong() arr[i++] arr i++ i nextLong() nextLong return arr; arr int n n void close() {
            try {
                reader.close();
            } catch (IOException e) {
                System.err.println("There's been an error trying closing the reader ");
                e.printStackTrace();
            }
        } close {
            try {
                reader.close();
            } catch (IOException e) {
                System.err.println("There's been an error trying closing the reader ");
                e.printStackTrace();
            }
        } try {
                reader.close();
            } catch (IOException e) {
                System.err.println("There's been an error trying closing the reader ");
                e.printStackTrace();
            } catch (IOException e) {
                System.err.println("There's been an error trying closing the reader ");
                e.printStackTrace();
            } IOException e {
                System.err.println("There's been an error trying closing the reader ");
                e.printStackTrace();
            } System.err.println("There's been an error trying closing the reader ") System.err.println System.err System System.err "There's been an error trying closing the reader " e.printStackTrace() e.printStackTrace e {
                reader.close();
            } reader.close() reader.close reader public class Main {


    public static void solve(FastReader fs, PrintWriter pw) {
        char[] s = fs.next().toCharArray();
        boolean[] f = new boolean[s.length + 1];
        f[0] = true;
        for (int i = 1; i <= s.length; i++) {
            if (i >= 5) {
                if (s[i - 1] == 'm' && s[i - 2] == 'a' && s[i - 3] == 'e' && s[i - 4] == 'r' && s[i - 5] == 'd') {
                    f[i] |= f[i - 5];
//                    System.err.println("found dream");
                    if (i + 1 < s.length && s[i] == 'e' && s[i + 1] == 'r') {
                        f[i + 2] |= f[i];
//                        System.err.println("found dreamer");
                    }

                } else if (s[i - 1] == 'e' && s[i - 2] == 's' && s[i - 3] == 'a' && s[i - 4] == 'r' && s[i - 5] == 'e') {
                    f[i] |= f[i - 5];
//                    System.err.println("found ERASE");
                    if (i < s.length && s[i] == 'r') {
                        f[i + 1] |= f[i];
//                        System.err.println("found dreamer");
                    }

                }


            }
        }
//        pw.println(Arrays.toString(f));
        pw.println((f[s.length] ? "YES" : "NO"));

    }

    public static void main(String[] args) throws Exception {
        FastReader fs = new FastReader(System.in);
        PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));

        solve(fs, pw);

        fs.close();
        pw.close();
    }

    static class FastReader {

        BufferedReader reader;
        StringTokenizer st;

        FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            String s = null;
            try {
                s = reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return next().charAt(0);
        }

        int[] nextIntArray(int n) {
            int[] arr = new int[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArray(int n) {
            long[] arr = new long[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        int[] nextIntArrayOneBased(int n) {
            int[] arr = new int[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArrayOneBased(int n) {
            long[] arr = new long[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        void close() {
            try {
                reader.close();
            } catch (IOException e) {
                System.err.println("There's been an error trying closing the reader ");
                e.printStackTrace();
            }
        }
    }


} public class Main {


    public static void solve(FastReader fs, PrintWriter pw) {
        char[] s = fs.next().toCharArray();
        boolean[] f = new boolean[s.length + 1];
        f[0] = true;
        for (int i = 1; i <= s.length; i++) {
            if (i >= 5) {
                if (s[i - 1] == 'm' && s[i - 2] == 'a' && s[i - 3] == 'e' && s[i - 4] == 'r' && s[i - 5] == 'd') {
                    f[i] |= f[i - 5];
//                    System.err.println("found dream");
                    if (i + 1 < s.length && s[i] == 'e' && s[i + 1] == 'r') {
                        f[i + 2] |= f[i];
//                        System.err.println("found dreamer");
                    }

                } else if (s[i - 1] == 'e' && s[i - 2] == 's' && s[i - 3] == 'a' && s[i - 4] == 'r' && s[i - 5] == 'e') {
                    f[i] |= f[i - 5];
//                    System.err.println("found ERASE");
                    if (i < s.length && s[i] == 'r') {
                        f[i + 1] |= f[i];
//                        System.err.println("found dreamer");
                    }

                }


            }
        }
//        pw.println(Arrays.toString(f));
        pw.println((f[s.length] ? "YES" : "NO"));

    }

    public static void main(String[] args) throws Exception {
        FastReader fs = new FastReader(System.in);
        PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));

        solve(fs, pw);

        fs.close();
        pw.close();
    }

    static class FastReader {

        BufferedReader reader;
        StringTokenizer st;

        FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            String s = null;
            try {
                s = reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return next().charAt(0);
        }

        int[] nextIntArray(int n) {
            int[] arr = new int[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArray(int n) {
            long[] arr = new long[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        int[] nextIntArrayOneBased(int n) {
            int[] arr = new int[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArrayOneBased(int n) {
            long[] arr = new long[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        void close() {
            try {
                reader.close();
            } catch (IOException e) {
                System.err.println("There's been an error trying closing the reader ");
                e.printStackTrace();
            }
        }
    }


} Main


/**
 * @Author Mehdi Maick
 * Created on 10/12/2016.
 */

import java.util.*;
import java.io.*;

import static java.lang.Math.*;

public class Main {


    public static void solve(FastReader fs, PrintWriter pw) {
        char[] s = fs.next().toCharArray();
        boolean[] f = new boolean[s.length + 1];
        f[0] = true;
        for (int i = 1; i <= s.length; i++) {
            if (i >= 5) {
                if (s[i - 1] == 'm' && s[i - 2] == 'a' && s[i - 3] == 'e' && s[i - 4] == 'r' && s[i - 5] == 'd') {
                    f[i] |= f[i - 5];
//                    System.err.println("found dream");
                    if (i + 1 < s.length && s[i] == 'e' && s[i + 1] == 'r') {
                        f[i + 2] |= f[i];
//                        System.err.println("found dreamer");
                    }

                } else if (s[i - 1] == 'e' && s[i - 2] == 's' && s[i - 3] == 'a' && s[i - 4] == 'r' && s[i - 5] == 'e') {
                    f[i] |= f[i - 5];
//                    System.err.println("found ERASE");
                    if (i < s.length && s[i] == 'r') {
                        f[i + 1] |= f[i];
//                        System.err.println("found dreamer");
                    }

                }


            }
        }
//        pw.println(Arrays.toString(f));
        pw.println((f[s.length] ? "YES" : "NO"));

    }

    public static void main(String[] args) throws Exception {
        FastReader fs = new FastReader(System.in);
        PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));

        solve(fs, pw);

        fs.close();
        pw.close();
    }

    static class FastReader {

        BufferedReader reader;
        StringTokenizer st;

        FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            String s = null;
            try {
                s = reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return next().charAt(0);
        }

        int[] nextIntArray(int n) {
            int[] arr = new int[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArray(int n) {
            long[] arr = new long[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        int[] nextIntArrayOneBased(int n) {
            int[] arr = new int[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArrayOneBased(int n) {
            long[] arr = new long[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        void close() {
            try {
                reader.close();
            } catch (IOException e) {
                System.err.println("There's been an error trying closing the reader ");
                e.printStackTrace();
            }
        }
    }


}