import java.util.Scanner;

public class Main {

	// 末尾に追加可能な文字列を反転した文字列
	private static final String REVERSE_DREAM = new StringBuilder("dream").reverse().toString();
	private static final String REVERSE_DREAMER = new StringBuilder("dreamer").reverse().toString();
	private static final String REVERSE_ERASE = new StringBuilder("erase").reverse().toString();
	private static final String REVERSE_ERASER = new StringBuilder("eraser").reverse().toString();

	public static void main(String[] args) {

		// 処理対象文字列の入力
		Scanner sc = new Scanner(System.in);

		// 最後尾から追加可能な文字列を検索するため、処理対象の文字列を反転させる
		StringBuilder targetString = new StringBuilder(sc.next()).reverse();
		sc.close();

		int bak = 0;
		// 処理対象の文字列の最後尾から、追加可能である文字列を可能な限り削除する処理を繰り返す
		// ※効率化のため文字列は反転して処理
		while(bak != targetString.length()) {
			bak = targetString.length();
			targetString = checkTopString(targetString);
		}

		// 出力
		if(targetString.length() == 0) {
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}

	}

	// 処理対象の文字列の最後尾に追加可能な文字列があるなら削除する関数(効率化のため処理は反転して行う)
	static StringBuilder checkTopString(StringBuilder targetString){
		if(targetString.indexOf(REVERSE_DREAM) == 0){
			return targetString.delete(0,REVERSE_DREAM.length());
		}

		if(targetString.indexOf(REVERSE_DREAMER) == 0){
			return targetString.delete(0,REVERSE_DREAMER.length());
		}

		if(targetString.indexOf(REVERSE_ERASE) == 0){
			return targetString.delete(0,REVERSE_ERASE.length());
		}

		if(targetString.indexOf(REVERSE_ERASER) == 0){
			return targetString.delete(0,REVERSE_ERASER.length());
		}

		return targetString;

	}

} import java.util.Scanner; Scanner java.util public class Main {

	// 末尾に追加可能な文字列を反転した文字列
	private static final String REVERSE_DREAM = new StringBuilder("dream").reverse().toString();
	private static final String REVERSE_DREAMER = new StringBuilder("dreamer").reverse().toString();
	private static final String REVERSE_ERASE = new StringBuilder("erase").reverse().toString();
	private static final String REVERSE_ERASER = new StringBuilder("eraser").reverse().toString();

	public static void main(String[] args) {

		// 処理対象文字列の入力
		Scanner sc = new Scanner(System.in);

		// 最後尾から追加可能な文字列を検索するため、処理対象の文字列を反転させる
		StringBuilder targetString = new StringBuilder(sc.next()).reverse();
		sc.close();

		int bak = 0;
		// 処理対象の文字列の最後尾から、追加可能である文字列を可能な限り削除する処理を繰り返す
		// ※効率化のため文字列は反転して処理
		while(bak != targetString.length()) {
			bak = targetString.length();
			targetString = checkTopString(targetString);
		}

		// 出力
		if(targetString.length() == 0) {
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}

	}

	// 処理対象の文字列の最後尾に追加可能な文字列があるなら削除する関数(効率化のため処理は反転して行う)
	static StringBuilder checkTopString(StringBuilder targetString){
		if(targetString.indexOf(REVERSE_DREAM) == 0){
			return targetString.delete(0,REVERSE_DREAM.length());
		}

		if(targetString.indexOf(REVERSE_DREAMER) == 0){
			return targetString.delete(0,REVERSE_DREAMER.length());
		}

		if(targetString.indexOf(REVERSE_ERASE) == 0){
			return targetString.delete(0,REVERSE_ERASE.length());
		}

		if(targetString.indexOf(REVERSE_ERASER) == 0){
			return targetString.delete(0,REVERSE_ERASER.length());
		}

		return targetString;

	}

} Main // 末尾に追加可能な文字列を反転した文字列
	private static final String REVERSE_DREAM = new StringBuilder("dream").reverse().toString(); REVERSE_DREAM new StringBuilder("dream").reverse().toString() new StringBuilder("dream").reverse().toString new StringBuilder("dream").reverse() new StringBuilder("dream").reverse new StringBuilder("dream") private static final String REVERSE_DREAMER = new StringBuilder("dreamer").reverse().toString(); REVERSE_DREAMER new StringBuilder("dreamer").reverse().toString() new StringBuilder("dreamer").reverse().toString new StringBuilder("dreamer").reverse() new StringBuilder("dreamer").reverse new StringBuilder("dreamer") private static final String REVERSE_ERASE = new StringBuilder("erase").reverse().toString(); REVERSE_ERASE new StringBuilder("erase").reverse().toString() new StringBuilder("erase").reverse().toString new StringBuilder("erase").reverse() new StringBuilder("erase").reverse new StringBuilder("erase") private static final String REVERSE_ERASER = new StringBuilder("eraser").reverse().toString(); REVERSE_ERASER new StringBuilder("eraser").reverse().toString() new StringBuilder("eraser").reverse().toString new StringBuilder("eraser").reverse() new StringBuilder("eraser").reverse new StringBuilder("eraser") public static void main(String[] args) {

		// 処理対象文字列の入力
		Scanner sc = new Scanner(System.in);

		// 最後尾から追加可能な文字列を検索するため、処理対象の文字列を反転させる
		StringBuilder targetString = new StringBuilder(sc.next()).reverse();
		sc.close();

		int bak = 0;
		// 処理対象の文字列の最後尾から、追加可能である文字列を可能な限り削除する処理を繰り返す
		// ※効率化のため文字列は反転して処理
		while(bak != targetString.length()) {
			bak = targetString.length();
			targetString = checkTopString(targetString);
		}

		// 出力
		if(targetString.length() == 0) {
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}

	} main {

		// 処理対象文字列の入力
		Scanner sc = new Scanner(System.in);

		// 最後尾から追加可能な文字列を検索するため、処理対象の文字列を反転させる
		StringBuilder targetString = new StringBuilder(sc.next()).reverse();
		sc.close();

		int bak = 0;
		// 処理対象の文字列の最後尾から、追加可能である文字列を可能な限り削除する処理を繰り返す
		// ※効率化のため文字列は反転して処理
		while(bak != targetString.length()) {
			bak = targetString.length();
			targetString = checkTopString(targetString);
		}

		// 出力
		if(targetString.length() == 0) {
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) StringBuilder targetString = new StringBuilder(sc.next()).reverse(); targetString new StringBuilder(sc.next()).reverse() new StringBuilder(sc.next()).reverse new StringBuilder(sc.next()) sc.close() sc.close sc int bak = 0; bak 0 while(bak != targetString.length()) {
			bak = targetString.length();
			targetString = checkTopString(targetString);
		} bak != targetString.length() bak targetString.length() targetString.length targetString {
			bak = targetString.length();
			targetString = checkTopString(targetString);
		} bak = targetString.length() bak targetString.length() targetString.length targetString targetString = checkTopString(targetString) targetString checkTopString(targetString) checkTopString targetString if(targetString.length() == 0) {
			System.out.println("YES");
		}else{
			System.out.println("NO");
		} targetString.length() == 0 targetString.length() targetString.length targetString 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 // 処理対象の文字列の最後尾に追加可能な文字列があるなら削除する関数(効率化のため処理は反転して行う)
	static StringBuilder checkTopString(StringBuilder targetString){
		if(targetString.indexOf(REVERSE_DREAM) == 0){
			return targetString.delete(0,REVERSE_DREAM.length());
		}

		if(targetString.indexOf(REVERSE_DREAMER) == 0){
			return targetString.delete(0,REVERSE_DREAMER.length());
		}

		if(targetString.indexOf(REVERSE_ERASE) == 0){
			return targetString.delete(0,REVERSE_ERASE.length());
		}

		if(targetString.indexOf(REVERSE_ERASER) == 0){
			return targetString.delete(0,REVERSE_ERASER.length());
		}

		return targetString;

	} checkTopString {
		if(targetString.indexOf(REVERSE_DREAM) == 0){
			return targetString.delete(0,REVERSE_DREAM.length());
		}

		if(targetString.indexOf(REVERSE_DREAMER) == 0){
			return targetString.delete(0,REVERSE_DREAMER.length());
		}

		if(targetString.indexOf(REVERSE_ERASE) == 0){
			return targetString.delete(0,REVERSE_ERASE.length());
		}

		if(targetString.indexOf(REVERSE_ERASER) == 0){
			return targetString.delete(0,REVERSE_ERASER.length());
		}

		return targetString;

	} if(targetString.indexOf(REVERSE_DREAM) == 0){
			return targetString.delete(0,REVERSE_DREAM.length());
		} targetString.indexOf(REVERSE_DREAM) == 0 targetString.indexOf(REVERSE_DREAM) targetString.indexOf targetString REVERSE_DREAM 0 {
			return targetString.delete(0,REVERSE_DREAM.length());
		} return targetString.delete(0,REVERSE_DREAM.length()); targetString.delete(0,REVERSE_DREAM.length()) targetString.delete targetString 0 REVERSE_DREAM.length() REVERSE_DREAM.length REVERSE_DREAM if(targetString.indexOf(REVERSE_DREAMER) == 0){
			return targetString.delete(0,REVERSE_DREAMER.length());
		} targetString.indexOf(REVERSE_DREAMER) == 0 targetString.indexOf(REVERSE_DREAMER) targetString.indexOf targetString REVERSE_DREAMER 0 {
			return targetString.delete(0,REVERSE_DREAMER.length());
		} return targetString.delete(0,REVERSE_DREAMER.length()); targetString.delete(0,REVERSE_DREAMER.length()) targetString.delete targetString 0 REVERSE_DREAMER.length() REVERSE_DREAMER.length REVERSE_DREAMER if(targetString.indexOf(REVERSE_ERASE) == 0){
			return targetString.delete(0,REVERSE_ERASE.length());
		} targetString.indexOf(REVERSE_ERASE) == 0 targetString.indexOf(REVERSE_ERASE) targetString.indexOf targetString REVERSE_ERASE 0 {
			return targetString.delete(0,REVERSE_ERASE.length());
		} return targetString.delete(0,REVERSE_ERASE.length()); targetString.delete(0,REVERSE_ERASE.length()) targetString.delete targetString 0 REVERSE_ERASE.length() REVERSE_ERASE.length REVERSE_ERASE if(targetString.indexOf(REVERSE_ERASER) == 0){
			return targetString.delete(0,REVERSE_ERASER.length());
		} targetString.indexOf(REVERSE_ERASER) == 0 targetString.indexOf(REVERSE_ERASER) targetString.indexOf targetString REVERSE_ERASER 0 {
			return targetString.delete(0,REVERSE_ERASER.length());
		} return targetString.delete(0,REVERSE_ERASER.length()); targetString.delete(0,REVERSE_ERASER.length()) targetString.delete targetString 0 REVERSE_ERASER.length() REVERSE_ERASER.length REVERSE_ERASER return targetString; targetString StringBuilder targetString targetString public class Main {

	// 末尾に追加可能な文字列を反転した文字列
	private static final String REVERSE_DREAM = new StringBuilder("dream").reverse().toString();
	private static final String REVERSE_DREAMER = new StringBuilder("dreamer").reverse().toString();
	private static final String REVERSE_ERASE = new StringBuilder("erase").reverse().toString();
	private static final String REVERSE_ERASER = new StringBuilder("eraser").reverse().toString();

	public static void main(String[] args) {

		// 処理対象文字列の入力
		Scanner sc = new Scanner(System.in);

		// 最後尾から追加可能な文字列を検索するため、処理対象の文字列を反転させる
		StringBuilder targetString = new StringBuilder(sc.next()).reverse();
		sc.close();

		int bak = 0;
		// 処理対象の文字列の最後尾から、追加可能である文字列を可能な限り削除する処理を繰り返す
		// ※効率化のため文字列は反転して処理
		while(bak != targetString.length()) {
			bak = targetString.length();
			targetString = checkTopString(targetString);
		}

		// 出力
		if(targetString.length() == 0) {
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}

	}

	// 処理対象の文字列の最後尾に追加可能な文字列があるなら削除する関数(効率化のため処理は反転して行う)
	static StringBuilder checkTopString(StringBuilder targetString){
		if(targetString.indexOf(REVERSE_DREAM) == 0){
			return targetString.delete(0,REVERSE_DREAM.length());
		}

		if(targetString.indexOf(REVERSE_DREAMER) == 0){
			return targetString.delete(0,REVERSE_DREAMER.length());
		}

		if(targetString.indexOf(REVERSE_ERASE) == 0){
			return targetString.delete(0,REVERSE_ERASE.length());
		}

		if(targetString.indexOf(REVERSE_ERASER) == 0){
			return targetString.delete(0,REVERSE_ERASER.length());
		}

		return targetString;

	}

} public class Main {

	// 末尾に追加可能な文字列を反転した文字列
	private static final String REVERSE_DREAM = new StringBuilder("dream").reverse().toString();
	private static final String REVERSE_DREAMER = new StringBuilder("dreamer").reverse().toString();
	private static final String REVERSE_ERASE = new StringBuilder("erase").reverse().toString();
	private static final String REVERSE_ERASER = new StringBuilder("eraser").reverse().toString();

	public static void main(String[] args) {

		// 処理対象文字列の入力
		Scanner sc = new Scanner(System.in);

		// 最後尾から追加可能な文字列を検索するため、処理対象の文字列を反転させる
		StringBuilder targetString = new StringBuilder(sc.next()).reverse();
		sc.close();

		int bak = 0;
		// 処理対象の文字列の最後尾から、追加可能である文字列を可能な限り削除する処理を繰り返す
		// ※効率化のため文字列は反転して処理
		while(bak != targetString.length()) {
			bak = targetString.length();
			targetString = checkTopString(targetString);
		}

		// 出力
		if(targetString.length() == 0) {
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}

	}

	// 処理対象の文字列の最後尾に追加可能な文字列があるなら削除する関数(効率化のため処理は反転して行う)
	static StringBuilder checkTopString(StringBuilder targetString){
		if(targetString.indexOf(REVERSE_DREAM) == 0){
			return targetString.delete(0,REVERSE_DREAM.length());
		}

		if(targetString.indexOf(REVERSE_DREAMER) == 0){
			return targetString.delete(0,REVERSE_DREAMER.length());
		}

		if(targetString.indexOf(REVERSE_ERASE) == 0){
			return targetString.delete(0,REVERSE_ERASE.length());
		}

		if(targetString.indexOf(REVERSE_ERASER) == 0){
			return targetString.delete(0,REVERSE_ERASER.length());
		}

		return targetString;

	}

} Main
import java.util.Scanner;

public class Main {

	// 末尾に追加可能な文字列を反転した文字列
	private static final String REVERSE_DREAM = new StringBuilder("dream").reverse().toString();
	private static final String REVERSE_DREAMER = new StringBuilder("dreamer").reverse().toString();
	private static final String REVERSE_ERASE = new StringBuilder("erase").reverse().toString();
	private static final String REVERSE_ERASER = new StringBuilder("eraser").reverse().toString();

	public static void main(String[] args) {

		// 処理対象文字列の入力
		Scanner sc = new Scanner(System.in);

		// 最後尾から追加可能な文字列を検索するため、処理対象の文字列を反転させる
		StringBuilder targetString = new StringBuilder(sc.next()).reverse();
		sc.close();

		int bak = 0;
		// 処理対象の文字列の最後尾から、追加可能である文字列を可能な限り削除する処理を繰り返す
		// ※効率化のため文字列は反転して処理
		while(bak != targetString.length()) {
			bak = targetString.length();
			targetString = checkTopString(targetString);
		}

		// 出力
		if(targetString.length() == 0) {
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}

	}

	// 処理対象の文字列の最後尾に追加可能な文字列があるなら削除する関数(効率化のため処理は反転して行う)
	static StringBuilder checkTopString(StringBuilder targetString){
		if(targetString.indexOf(REVERSE_DREAM) == 0){
			return targetString.delete(0,REVERSE_DREAM.length());
		}

		if(targetString.indexOf(REVERSE_DREAMER) == 0){
			return targetString.delete(0,REVERSE_DREAMER.length());
		}

		if(targetString.indexOf(REVERSE_ERASE) == 0){
			return targetString.delete(0,REVERSE_ERASE.length());
		}

		if(targetString.indexOf(REVERSE_ERASER) == 0){
			return targetString.delete(0,REVERSE_ERASER.length());
		}

		return targetString;

	}

}