import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        // 入力処理
        Scanner sc = new Scanner(System.in);
        
        String str = sc.nextLine();

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

        for (String word : words) {
            if (str.matches(".*" + word + ".*")) {
                str = str.replaceAll(word, "");
            }
        }

        if (str.length() == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        // 入力処理
        Scanner sc = new Scanner(System.in);
        
        String str = sc.nextLine();

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

        for (String word : words) {
            if (str.matches(".*" + word + ".*")) {
                str = str.replaceAll(word, "");
            }
        }

        if (str.length() == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} Main public static void main(String[] args) {
        // 入力処理
        Scanner sc = new Scanner(System.in);
        
        String str = sc.nextLine();

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

        for (String word : words) {
            if (str.matches(".*" + word + ".*")) {
                str = str.replaceAll(word, "");
            }
        }

        if (str.length() == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    } main {
        // 入力処理
        Scanner sc = new Scanner(System.in);
        
        String str = sc.nextLine();

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

        for (String word : words) {
            if (str.matches(".*" + word + ".*")) {
                str = str.replaceAll(word, "");
            }
        }

        if (str.length() == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc String[] words = {"eraser", "erase", "dreamer", "dream"}; words {"eraser", "erase", "dreamer", "dream"} "eraser" "erase" "dreamer" "dream" for (String word : words) {
            if (str.matches(".*" + word + ".*")) {
                str = str.replaceAll(word, "");
            }
        } String word words {
            if (str.matches(".*" + word + ".*")) {
                str = str.replaceAll(word, "");
            }
        } {
            if (str.matches(".*" + word + ".*")) {
                str = str.replaceAll(word, "");
            }
        } if (str.matches(".*" + word + ".*")) {
                str = str.replaceAll(word, "");
            } str.matches(".*" + word + ".*") str.matches str ".*" + word + ".*" ".*" + word + ".*" ".*" word ".*" {
                str = str.replaceAll(word, "");
            } str = str.replaceAll(word, "") str str.replaceAll(word, "") str.replaceAll str word "" if (str.length() == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        } str.length() == 0 str.length() str.length str 0 {
            System.out.println("YES");
        } System.out.println("YES") System.out.println System.out System System.out "YES" {
            System.out.println("NO");
        } System.out.println("NO") System.out.println System.out System System.out "NO" String[] args args public class Main {
    public static void main(String[] args) {
        // 入力処理
        Scanner sc = new Scanner(System.in);
        
        String str = sc.nextLine();

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

        for (String word : words) {
            if (str.matches(".*" + word + ".*")) {
                str = str.replaceAll(word, "");
            }
        }

        if (str.length() == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} public class Main {
    public static void main(String[] args) {
        // 入力処理
        Scanner sc = new Scanner(System.in);
        
        String str = sc.nextLine();

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

        for (String word : words) {
            if (str.matches(".*" + word + ".*")) {
                str = str.replaceAll(word, "");
            }
        }

        if (str.length() == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        // 入力処理
        Scanner sc = new Scanner(System.in);
        
        String str = sc.nextLine();

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

        for (String word : words) {
            if (str.matches(".*" + word + ".*")) {
                str = str.replaceAll(word, "");
            }
        }

        if (str.length() == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}
