import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        String[] words = {"dream", "dreamer", "erase", "eraser"};

        for (int i = 0; i < 4; i++) {
            words[i] = reverseString(words[i]);
        }

        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String S = null;
        try {
            S = bufferedReader.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }

        S = reverseString(S);

        String answer = "YES";
        boolean isMatch;
        for (int i = 0; i < S.length();) {
            isMatch = false;
            for (String word : words) {
                if (isStartWith(i, S, word)) {
                    isMatch = true;
                    //S =  S.substring(word.length());
                    i += word.length();
                    break;
                }
            }
            if (!isMatch) {
                answer = "NO";
                break;
            }
        }
        System.out.format(answer);
    }

    private static boolean isStartWith(int index, String s, String word) {
        if (s.length() < word.length()) {
            return false;
        }
        boolean reslut = false;
        try {
            reslut = s.substring(index, index + word.length()).equals(word);
        } catch (Exception e) {
            return false;
        }
        return reslut;
    }

    private static String reverseString(String input) {
        StringBuilder builder = new StringBuilder();
        builder.append(input);
        return builder.reverse().toString();
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String[] args) {
        String[] words = {"dream", "dreamer", "erase", "eraser"};

        for (int i = 0; i < 4; i++) {
            words[i] = reverseString(words[i]);
        }

        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String S = null;
        try {
            S = bufferedReader.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }

        S = reverseString(S);

        String answer = "YES";
        boolean isMatch;
        for (int i = 0; i < S.length();) {
            isMatch = false;
            for (String word : words) {
                if (isStartWith(i, S, word)) {
                    isMatch = true;
                    //S =  S.substring(word.length());
                    i += word.length();
                    break;
                }
            }
            if (!isMatch) {
                answer = "NO";
                break;
            }
        }
        System.out.format(answer);
    }

    private static boolean isStartWith(int index, String s, String word) {
        if (s.length() < word.length()) {
            return false;
        }
        boolean reslut = false;
        try {
            reslut = s.substring(index, index + word.length()).equals(word);
        } catch (Exception e) {
            return false;
        }
        return reslut;
    }

    private static String reverseString(String input) {
        StringBuilder builder = new StringBuilder();
        builder.append(input);
        return builder.reverse().toString();
    }
} Main public static void main(String[] args) {
        String[] words = {"dream", "dreamer", "erase", "eraser"};

        for (int i = 0; i < 4; i++) {
            words[i] = reverseString(words[i]);
        }

        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String S = null;
        try {
            S = bufferedReader.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }

        S = reverseString(S);

        String answer = "YES";
        boolean isMatch;
        for (int i = 0; i < S.length();) {
            isMatch = false;
            for (String word : words) {
                if (isStartWith(i, S, word)) {
                    isMatch = true;
                    //S =  S.substring(word.length());
                    i += word.length();
                    break;
                }
            }
            if (!isMatch) {
                answer = "NO";
                break;
            }
        }
        System.out.format(answer);
    } main {
        String[] words = {"dream", "dreamer", "erase", "eraser"};

        for (int i = 0; i < 4; i++) {
            words[i] = reverseString(words[i]);
        }

        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String S = null;
        try {
            S = bufferedReader.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }

        S = reverseString(S);

        String answer = "YES";
        boolean isMatch;
        for (int i = 0; i < S.length();) {
            isMatch = false;
            for (String word : words) {
                if (isStartWith(i, S, word)) {
                    isMatch = true;
                    //S =  S.substring(word.length());
                    i += word.length();
                    break;
                }
            }
            if (!isMatch) {
                answer = "NO";
                break;
            }
        }
        System.out.format(answer);
    } String[] words = {"dream", "dreamer", "erase", "eraser"}; words {"dream", "dreamer", "erase", "eraser"} "dream" "dreamer" "erase" "eraser" for (int i = 0; i < 4; i++) {
            words[i] = reverseString(words[i]);
        } int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
            words[i] = reverseString(words[i]);
        } {
            words[i] = reverseString(words[i]);
        } words[i] = reverseString(words[i]) words[i] words i reverseString(words[i]) reverseString words[i] words i BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); bufferedReader new BufferedReader(new InputStreamReader(System.in)) String S = null; S null try {
            S = bufferedReader.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } IOException e {
            e.printStackTrace();
        } e.printStackTrace() e.printStackTrace e {
            S = bufferedReader.readLine();
        } S = bufferedReader.readLine() S bufferedReader.readLine() bufferedReader.readLine bufferedReader S = reverseString(S) S reverseString(S) reverseString S String answer = "YES"; answer "YES" boolean isMatch; isMatch for (int i = 0; i < S.length();) {
            isMatch = false;
            for (String word : words) {
                if (isStartWith(i, S, word)) {
                    isMatch = true;
                    //S =  S.substring(word.length());
                    i += word.length();
                    break;
                }
            }
            if (!isMatch) {
                answer = "NO";
                break;
            }
        } int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S {
            isMatch = false;
            for (String word : words) {
                if (isStartWith(i, S, word)) {
                    isMatch = true;
                    //S =  S.substring(word.length());
                    i += word.length();
                    break;
                }
            }
            if (!isMatch) {
                answer = "NO";
                break;
            }
        } {
            isMatch = false;
            for (String word : words) {
                if (isStartWith(i, S, word)) {
                    isMatch = true;
                    //S =  S.substring(word.length());
                    i += word.length();
                    break;
                }
            }
            if (!isMatch) {
                answer = "NO";
                break;
            }
        } isMatch = false isMatch false for (String word : words) {
                if (isStartWith(i, S, word)) {
                    isMatch = true;
                    //S =  S.substring(word.length());
                    i += word.length();
                    break;
                }
            } String word words {
                if (isStartWith(i, S, word)) {
                    isMatch = true;
                    //S =  S.substring(word.length());
                    i += word.length();
                    break;
                }
            } {
                if (isStartWith(i, S, word)) {
                    isMatch = true;
                    //S =  S.substring(word.length());
                    i += word.length();
                    break;
                }
            } if (isStartWith(i, S, word)) {
                    isMatch = true;
                    //S =  S.substring(word.length());
                    i += word.length();
                    break;
                } isStartWith(i, S, word) isStartWith i S word {
                    isMatch = true;
                    //S =  S.substring(word.length());
                    i += word.length();
                    break;
                } isMatch = true isMatch true i += word.length() i word.length() word.length word break; if (!isMatch) {
                answer = "NO";
                break;
            } !isMatch isMatch {
                answer = "NO";
                break;
            } answer = "NO" answer "NO" break; System.out.format(answer) System.out.format System.out System System.out answer String[] args args private static boolean isStartWith(int index, String s, String word) {
        if (s.length() < word.length()) {
            return false;
        }
        boolean reslut = false;
        try {
            reslut = s.substring(index, index + word.length()).equals(word);
        } catch (Exception e) {
            return false;
        }
        return reslut;
    } isStartWith {
        if (s.length() < word.length()) {
            return false;
        }
        boolean reslut = false;
        try {
            reslut = s.substring(index, index + word.length()).equals(word);
        } catch (Exception e) {
            return false;
        }
        return reslut;
    } if (s.length() < word.length()) {
            return false;
        } s.length() < word.length() s.length() s.length s word.length() word.length word {
            return false;
        } return false; false boolean reslut = false; reslut false try {
            reslut = s.substring(index, index + word.length()).equals(word);
        } catch (Exception e) {
            return false;
        } catch (Exception e) {
            return false;
        } Exception e {
            return false;
        } return false; false {
            reslut = s.substring(index, index + word.length()).equals(word);
        } reslut = s.substring(index, index + word.length()).equals(word) reslut s.substring(index, index + word.length()).equals(word) s.substring(index, index + word.length()).equals s.substring(index, index + word.length()) s.substring s index index + word.length() index word.length() word.length word word return reslut; reslut int index index String s s String word word private static String reverseString(String input) {
        StringBuilder builder = new StringBuilder();
        builder.append(input);
        return builder.reverse().toString();
    } reverseString {
        StringBuilder builder = new StringBuilder();
        builder.append(input);
        return builder.reverse().toString();
    } StringBuilder builder = new StringBuilder(); builder new StringBuilder() builder.append(input) builder.append builder input return builder.reverse().toString(); builder.reverse().toString() builder.reverse().toString builder.reverse() builder.reverse builder String input input public class Main {
    public static void main(String[] args) {
        String[] words = {"dream", "dreamer", "erase", "eraser"};

        for (int i = 0; i < 4; i++) {
            words[i] = reverseString(words[i]);
        }

        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String S = null;
        try {
            S = bufferedReader.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }

        S = reverseString(S);

        String answer = "YES";
        boolean isMatch;
        for (int i = 0; i < S.length();) {
            isMatch = false;
            for (String word : words) {
                if (isStartWith(i, S, word)) {
                    isMatch = true;
                    //S =  S.substring(word.length());
                    i += word.length();
                    break;
                }
            }
            if (!isMatch) {
                answer = "NO";
                break;
            }
        }
        System.out.format(answer);
    }

    private static boolean isStartWith(int index, String s, String word) {
        if (s.length() < word.length()) {
            return false;
        }
        boolean reslut = false;
        try {
            reslut = s.substring(index, index + word.length()).equals(word);
        } catch (Exception e) {
            return false;
        }
        return reslut;
    }

    private static String reverseString(String input) {
        StringBuilder builder = new StringBuilder();
        builder.append(input);
        return builder.reverse().toString();
    }
} public class Main {
    public static void main(String[] args) {
        String[] words = {"dream", "dreamer", "erase", "eraser"};

        for (int i = 0; i < 4; i++) {
            words[i] = reverseString(words[i]);
        }

        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String S = null;
        try {
            S = bufferedReader.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }

        S = reverseString(S);

        String answer = "YES";
        boolean isMatch;
        for (int i = 0; i < S.length();) {
            isMatch = false;
            for (String word : words) {
                if (isStartWith(i, S, word)) {
                    isMatch = true;
                    //S =  S.substring(word.length());
                    i += word.length();
                    break;
                }
            }
            if (!isMatch) {
                answer = "NO";
                break;
            }
        }
        System.out.format(answer);
    }

    private static boolean isStartWith(int index, String s, String word) {
        if (s.length() < word.length()) {
            return false;
        }
        boolean reslut = false;
        try {
            reslut = s.substring(index, index + word.length()).equals(word);
        } catch (Exception e) {
            return false;
        }
        return reslut;
    }

    private static String reverseString(String input) {
        StringBuilder builder = new StringBuilder();
        builder.append(input);
        return builder.reverse().toString();
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        String[] words = {"dream", "dreamer", "erase", "eraser"};

        for (int i = 0; i < 4; i++) {
            words[i] = reverseString(words[i]);
        }

        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String S = null;
        try {
            S = bufferedReader.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }

        S = reverseString(S);

        String answer = "YES";
        boolean isMatch;
        for (int i = 0; i < S.length();) {
            isMatch = false;
            for (String word : words) {
                if (isStartWith(i, S, word)) {
                    isMatch = true;
                    //S =  S.substring(word.length());
                    i += word.length();
                    break;
                }
            }
            if (!isMatch) {
                answer = "NO";
                break;
            }
        }
        System.out.format(answer);
    }

    private static boolean isStartWith(int index, String s, String word) {
        if (s.length() < word.length()) {
            return false;
        }
        boolean reslut = false;
        try {
            reslut = s.substring(index, index + word.length()).equals(word);
        } catch (Exception e) {
            return false;
        }
        return reslut;
    }

    private static String reverseString(String input) {
        StringBuilder builder = new StringBuilder();
        builder.append(input);
        return builder.reverse().toString();
    }
}