
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();

        String[] patternList = new String[] {"dreamer", "dream", "eraser", "erase"};
        for (int i = 0; i < 4; ++i) {
            patternList[i] = new StringBuilder(patternList[i]).reverse().toString();
        }

        S = new StringBuilder(S).reverse().toString();

        for (int i= 0; i< S.length();) {
            boolean exists = false;
            for (int k = 0; k < 4; k++) {
                if (i + patternList[k].length() - 1 >= S.length()) {
                    continue;
                }
                if (S.substring(i, i + patternList[k].length()).equals(patternList[k])) {
                    exists = true;
                    i += patternList[k].length();
                    break;
                }
            }
            if (!exists) {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();

        String[] patternList = new String[] {"dreamer", "dream", "eraser", "erase"};
        for (int i = 0; i < 4; ++i) {
            patternList[i] = new StringBuilder(patternList[i]).reverse().toString();
        }

        S = new StringBuilder(S).reverse().toString();

        for (int i= 0; i< S.length();) {
            boolean exists = false;
            for (int k = 0; k < 4; k++) {
                if (i + patternList[k].length() - 1 >= S.length()) {
                    continue;
                }
                if (S.substring(i, i + patternList[k].length()).equals(patternList[k])) {
                    exists = true;
                    i += patternList[k].length();
                    break;
                }
            }
            if (!exists) {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();

        String[] patternList = new String[] {"dreamer", "dream", "eraser", "erase"};
        for (int i = 0; i < 4; ++i) {
            patternList[i] = new StringBuilder(patternList[i]).reverse().toString();
        }

        S = new StringBuilder(S).reverse().toString();

        for (int i= 0; i< S.length();) {
            boolean exists = false;
            for (int k = 0; k < 4; k++) {
                if (i + patternList[k].length() - 1 >= S.length()) {
                    continue;
                }
                if (S.substring(i, i + patternList[k].length()).equals(patternList[k])) {
                    exists = true;
                    i += patternList[k].length();
                    break;
                }
            }
            if (!exists) {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    } main {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();

        String[] patternList = new String[] {"dreamer", "dream", "eraser", "erase"};
        for (int i = 0; i < 4; ++i) {
            patternList[i] = new StringBuilder(patternList[i]).reverse().toString();
        }

        S = new StringBuilder(S).reverse().toString();

        for (int i= 0; i< S.length();) {
            boolean exists = false;
            for (int k = 0; k < 4; k++) {
                if (i + patternList[k].length() - 1 >= S.length()) {
                    continue;
                }
                if (S.substring(i, i + patternList[k].length()).equals(patternList[k])) {
                    exists = true;
                    i += patternList[k].length();
                    break;
                }
            }
            if (!exists) {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String S = scanner.next(); S scanner.next() scanner.next scanner String[] patternList = new String[] {"dreamer", "dream", "eraser", "erase"}; patternList new String[] {"dreamer", "dream", "eraser", "erase"} for (int i = 0; i < 4; ++i) {
            patternList[i] = new StringBuilder(patternList[i]).reverse().toString();
        } int i = 0; int i = 0; i 0 i < 4 i 4 ++i ++i i {
            patternList[i] = new StringBuilder(patternList[i]).reverse().toString();
        } {
            patternList[i] = new StringBuilder(patternList[i]).reverse().toString();
        } patternList[i] = new StringBuilder(patternList[i]).reverse().toString() patternList[i] patternList i new StringBuilder(patternList[i]).reverse().toString() new StringBuilder(patternList[i]).reverse().toString new StringBuilder(patternList[i]).reverse() new StringBuilder(patternList[i]).reverse new StringBuilder(patternList[i]) S = new StringBuilder(S).reverse().toString() S new StringBuilder(S).reverse().toString() new StringBuilder(S).reverse().toString new StringBuilder(S).reverse() new StringBuilder(S).reverse new StringBuilder(S) for (int i= 0; i< S.length();) {
            boolean exists = false;
            for (int k = 0; k < 4; k++) {
                if (i + patternList[k].length() - 1 >= S.length()) {
                    continue;
                }
                if (S.substring(i, i + patternList[k].length()).equals(patternList[k])) {
                    exists = true;
                    i += patternList[k].length();
                    break;
                }
            }
            if (!exists) {
                System.out.println("NO");
                return;
            }
        } int i= 0; int i= 0; i 0 i< S.length() i S.length() S.length S {
            boolean exists = false;
            for (int k = 0; k < 4; k++) {
                if (i + patternList[k].length() - 1 >= S.length()) {
                    continue;
                }
                if (S.substring(i, i + patternList[k].length()).equals(patternList[k])) {
                    exists = true;
                    i += patternList[k].length();
                    break;
                }
            }
            if (!exists) {
                System.out.println("NO");
                return;
            }
        } {
            boolean exists = false;
            for (int k = 0; k < 4; k++) {
                if (i + patternList[k].length() - 1 >= S.length()) {
                    continue;
                }
                if (S.substring(i, i + patternList[k].length()).equals(patternList[k])) {
                    exists = true;
                    i += patternList[k].length();
                    break;
                }
            }
            if (!exists) {
                System.out.println("NO");
                return;
            }
        } boolean exists = false; exists false for (int k = 0; k < 4; k++) {
                if (i + patternList[k].length() - 1 >= S.length()) {
                    continue;
                }
                if (S.substring(i, i + patternList[k].length()).equals(patternList[k])) {
                    exists = true;
                    i += patternList[k].length();
                    break;
                }
            } int k = 0; int k = 0; k 0 k < 4 k 4 k++ k++ k {
                if (i + patternList[k].length() - 1 >= S.length()) {
                    continue;
                }
                if (S.substring(i, i + patternList[k].length()).equals(patternList[k])) {
                    exists = true;
                    i += patternList[k].length();
                    break;
                }
            } {
                if (i + patternList[k].length() - 1 >= S.length()) {
                    continue;
                }
                if (S.substring(i, i + patternList[k].length()).equals(patternList[k])) {
                    exists = true;
                    i += patternList[k].length();
                    break;
                }
            } if (i + patternList[k].length() - 1 >= S.length()) {
                    continue;
                } i + patternList[k].length() - 1 >= S.length() i + patternList[k].length() - 1 i + patternList[k].length() i patternList[k].length() patternList[k].length patternList[k] patternList k 1 S.length() S.length S {
                    continue;
                } continue; if (S.substring(i, i + patternList[k].length()).equals(patternList[k])) {
                    exists = true;
                    i += patternList[k].length();
                    break;
                } S.substring(i, i + patternList[k].length()).equals(patternList[k]) S.substring(i, i + patternList[k].length()).equals S.substring(i, i + patternList[k].length()) S.substring S i i + patternList[k].length() i patternList[k].length() patternList[k].length patternList[k] patternList k patternList[k] patternList k {
                    exists = true;
                    i += patternList[k].length();
                    break;
                } exists = true exists true i += patternList[k].length() i patternList[k].length() patternList[k].length patternList[k] patternList k break; if (!exists) {
                System.out.println("NO");
                return;
            } !exists exists {
                System.out.println("NO");
                return;
            } System.out.println("NO") System.out.println System.out System System.out "NO" return; System.out.println("YES") System.out.println System.out System System.out "YES" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();

        String[] patternList = new String[] {"dreamer", "dream", "eraser", "erase"};
        for (int i = 0; i < 4; ++i) {
            patternList[i] = new StringBuilder(patternList[i]).reverse().toString();
        }

        S = new StringBuilder(S).reverse().toString();

        for (int i= 0; i< S.length();) {
            boolean exists = false;
            for (int k = 0; k < 4; k++) {
                if (i + patternList[k].length() - 1 >= S.length()) {
                    continue;
                }
                if (S.substring(i, i + patternList[k].length()).equals(patternList[k])) {
                    exists = true;
                    i += patternList[k].length();
                    break;
                }
            }
            if (!exists) {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();

        String[] patternList = new String[] {"dreamer", "dream", "eraser", "erase"};
        for (int i = 0; i < 4; ++i) {
            patternList[i] = new StringBuilder(patternList[i]).reverse().toString();
        }

        S = new StringBuilder(S).reverse().toString();

        for (int i= 0; i< S.length();) {
            boolean exists = false;
            for (int k = 0; k < 4; k++) {
                if (i + patternList[k].length() - 1 >= S.length()) {
                    continue;
                }
                if (S.substring(i, i + patternList[k].length()).equals(patternList[k])) {
                    exists = true;
                    i += patternList[k].length();
                    break;
                }
            }
            if (!exists) {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
} Main

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();

        String[] patternList = new String[] {"dreamer", "dream", "eraser", "erase"};
        for (int i = 0; i < 4; ++i) {
            patternList[i] = new StringBuilder(patternList[i]).reverse().toString();
        }

        S = new StringBuilder(S).reverse().toString();

        for (int i= 0; i< S.length();) {
            boolean exists = false;
            for (int k = 0; k < 4; k++) {
                if (i + patternList[k].length() - 1 >= S.length()) {
                    continue;
                }
                if (S.substring(i, i + patternList[k].length()).equals(patternList[k])) {
                    exists = true;
                    i += patternList[k].length();
                    break;
                }
            }
            if (!exists) {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
}
