import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

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

        String S = scanner.next();

        StringBuilder sb = new StringBuilder(S);

        S = sb.reverse().toString();

        // dream, dreamer, erase, eraser

        String[] keywords = {
                "dream", "dreamer", "erase", "eraser"
        };

        List<String> reversedKeywords = new ArrayList();

        for (String s : keywords) {
            reversedKeywords.add((new StringBuilder(s)).reverse().toString());
        }

        for (int i = 0; i < S.length();) {
            boolean found = false;
            for (String reversed : reversedKeywords) {
                if (S.startsWith(reversed, i)) {
                    i += reversed.length();
                    found = true;
                    break;
                }
            }
            if (!found) {
                System.out.println("NO");
                return;
            }
        }

        System.out.println("YES");
    }
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util 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();

        StringBuilder sb = new StringBuilder(S);

        S = sb.reverse().toString();

        // dream, dreamer, erase, eraser

        String[] keywords = {
                "dream", "dreamer", "erase", "eraser"
        };

        List<String> reversedKeywords = new ArrayList();

        for (String s : keywords) {
            reversedKeywords.add((new StringBuilder(s)).reverse().toString());
        }

        for (int i = 0; i < S.length();) {
            boolean found = false;
            for (String reversed : reversedKeywords) {
                if (S.startsWith(reversed, i)) {
                    i += reversed.length();
                    found = true;
                    break;
                }
            }
            if (!found) {
                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();

        StringBuilder sb = new StringBuilder(S);

        S = sb.reverse().toString();

        // dream, dreamer, erase, eraser

        String[] keywords = {
                "dream", "dreamer", "erase", "eraser"
        };

        List<String> reversedKeywords = new ArrayList();

        for (String s : keywords) {
            reversedKeywords.add((new StringBuilder(s)).reverse().toString());
        }

        for (int i = 0; i < S.length();) {
            boolean found = false;
            for (String reversed : reversedKeywords) {
                if (S.startsWith(reversed, i)) {
                    i += reversed.length();
                    found = true;
                    break;
                }
            }
            if (!found) {
                System.out.println("NO");
                return;
            }
        }

        System.out.println("YES");
    } main {
        Scanner scanner = new Scanner(System.in);

        String S = scanner.next();

        StringBuilder sb = new StringBuilder(S);

        S = sb.reverse().toString();

        // dream, dreamer, erase, eraser

        String[] keywords = {
                "dream", "dreamer", "erase", "eraser"
        };

        List<String> reversedKeywords = new ArrayList();

        for (String s : keywords) {
            reversedKeywords.add((new StringBuilder(s)).reverse().toString());
        }

        for (int i = 0; i < S.length();) {
            boolean found = false;
            for (String reversed : reversedKeywords) {
                if (S.startsWith(reversed, i)) {
                    i += reversed.length();
                    found = true;
                    break;
                }
            }
            if (!found) {
                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 StringBuilder sb = new StringBuilder(S); sb new StringBuilder(S) S = sb.reverse().toString() S sb.reverse().toString() sb.reverse().toString sb.reverse() sb.reverse sb String[] keywords = {
                "dream", "dreamer", "erase", "eraser"
        }; keywords {
                "dream", "dreamer", "erase", "eraser"
        } "dream" "dreamer" "erase" "eraser" List<String> reversedKeywords = new ArrayList(); reversedKeywords new ArrayList() for (String s : keywords) {
            reversedKeywords.add((new StringBuilder(s)).reverse().toString());
        } String s keywords {
            reversedKeywords.add((new StringBuilder(s)).reverse().toString());
        } {
            reversedKeywords.add((new StringBuilder(s)).reverse().toString());
        } reversedKeywords.add((new StringBuilder(s)).reverse().toString()) reversedKeywords.add reversedKeywords (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 found = false;
            for (String reversed : reversedKeywords) {
                if (S.startsWith(reversed, i)) {
                    i += reversed.length();
                    found = true;
                    break;
                }
            }
            if (!found) {
                System.out.println("NO");
                return;
            }
        } int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S {
            boolean found = false;
            for (String reversed : reversedKeywords) {
                if (S.startsWith(reversed, i)) {
                    i += reversed.length();
                    found = true;
                    break;
                }
            }
            if (!found) {
                System.out.println("NO");
                return;
            }
        } {
            boolean found = false;
            for (String reversed : reversedKeywords) {
                if (S.startsWith(reversed, i)) {
                    i += reversed.length();
                    found = true;
                    break;
                }
            }
            if (!found) {
                System.out.println("NO");
                return;
            }
        } boolean found = false; found false for (String reversed : reversedKeywords) {
                if (S.startsWith(reversed, i)) {
                    i += reversed.length();
                    found = true;
                    break;
                }
            } String reversed reversedKeywords {
                if (S.startsWith(reversed, i)) {
                    i += reversed.length();
                    found = true;
                    break;
                }
            } {
                if (S.startsWith(reversed, i)) {
                    i += reversed.length();
                    found = true;
                    break;
                }
            } if (S.startsWith(reversed, i)) {
                    i += reversed.length();
                    found = true;
                    break;
                } S.startsWith(reversed, i) S.startsWith S reversed i {
                    i += reversed.length();
                    found = true;
                    break;
                } i += reversed.length() i reversed.length() reversed.length reversed found = true found true break; if (!found) {
                System.out.println("NO");
                return;
            } !found found {
                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();

        StringBuilder sb = new StringBuilder(S);

        S = sb.reverse().toString();

        // dream, dreamer, erase, eraser

        String[] keywords = {
                "dream", "dreamer", "erase", "eraser"
        };

        List<String> reversedKeywords = new ArrayList();

        for (String s : keywords) {
            reversedKeywords.add((new StringBuilder(s)).reverse().toString());
        }

        for (int i = 0; i < S.length();) {
            boolean found = false;
            for (String reversed : reversedKeywords) {
                if (S.startsWith(reversed, i)) {
                    i += reversed.length();
                    found = true;
                    break;
                }
            }
            if (!found) {
                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();

        StringBuilder sb = new StringBuilder(S);

        S = sb.reverse().toString();

        // dream, dreamer, erase, eraser

        String[] keywords = {
                "dream", "dreamer", "erase", "eraser"
        };

        List<String> reversedKeywords = new ArrayList();

        for (String s : keywords) {
            reversedKeywords.add((new StringBuilder(s)).reverse().toString());
        }

        for (int i = 0; i < S.length();) {
            boolean found = false;
            for (String reversed : reversedKeywords) {
                if (S.startsWith(reversed, i)) {
                    i += reversed.length();
                    found = true;
                    break;
                }
            }
            if (!found) {
                System.out.println("NO");
                return;
            }
        }

        System.out.println("YES");
    }
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

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

        String S = scanner.next();

        StringBuilder sb = new StringBuilder(S);

        S = sb.reverse().toString();

        // dream, dreamer, erase, eraser

        String[] keywords = {
                "dream", "dreamer", "erase", "eraser"
        };

        List<String> reversedKeywords = new ArrayList();

        for (String s : keywords) {
            reversedKeywords.add((new StringBuilder(s)).reverse().toString());
        }

        for (int i = 0; i < S.length();) {
            boolean found = false;
            for (String reversed : reversedKeywords) {
                if (S.startsWith(reversed, i)) {
                    i += reversed.length();
                    found = true;
                    break;
                }
            }
            if (!found) {
                System.out.println("NO");
                return;
            }
        }

        System.out.println("YES");
    }
}