import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		S = new StringBuffer(S).reverse().toString();
		String[] keys = {"dream", "dreamer", "erase", "eraser"};
		boolean can = true;
		for (int i=0; i<S.length();) {
			boolean can2 = false;
			for (int j=0; j<4; j++) {
				String key = keys[j];
				key = new StringBuffer(key).reverse().toString();
				if ( i+key.length() > S.length() ) continue;
				if ( (S.substring(i, i+key.length())).equals(key) ){
					can2 = true;
					i+=key.length();
				}
			}
			if ( !can2 ) {
				can = false;
				break;
			}
		}
		if (can) 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 S = sc.next();
		S = new StringBuffer(S).reverse().toString();
		String[] keys = {"dream", "dreamer", "erase", "eraser"};
		boolean can = true;
		for (int i=0; i<S.length();) {
			boolean can2 = false;
			for (int j=0; j<4; j++) {
				String key = keys[j];
				key = new StringBuffer(key).reverse().toString();
				if ( i+key.length() > S.length() ) continue;
				if ( (S.substring(i, i+key.length())).equals(key) ){
					can2 = true;
					i+=key.length();
				}
			}
			if ( !can2 ) {
				can = false;
				break;
			}
		}
		if (can) System.out.println("YES");
		else System.out.println("NO");
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		S = new StringBuffer(S).reverse().toString();
		String[] keys = {"dream", "dreamer", "erase", "eraser"};
		boolean can = true;
		for (int i=0; i<S.length();) {
			boolean can2 = false;
			for (int j=0; j<4; j++) {
				String key = keys[j];
				key = new StringBuffer(key).reverse().toString();
				if ( i+key.length() > S.length() ) continue;
				if ( (S.substring(i, i+key.length())).equals(key) ){
					can2 = true;
					i+=key.length();
				}
			}
			if ( !can2 ) {
				can = false;
				break;
			}
		}
		if (can) System.out.println("YES");
		else System.out.println("NO");
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		S = new StringBuffer(S).reverse().toString();
		String[] keys = {"dream", "dreamer", "erase", "eraser"};
		boolean can = true;
		for (int i=0; i<S.length();) {
			boolean can2 = false;
			for (int j=0; j<4; j++) {
				String key = keys[j];
				key = new StringBuffer(key).reverse().toString();
				if ( i+key.length() > S.length() ) continue;
				if ( (S.substring(i, i+key.length())).equals(key) ){
					can2 = true;
					i+=key.length();
				}
			}
			if ( !can2 ) {
				can = false;
				break;
			}
		}
		if (can) System.out.println("YES");
		else System.out.println("NO");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc S = new StringBuffer(S).reverse().toString() S new StringBuffer(S).reverse().toString() new StringBuffer(S).reverse().toString new StringBuffer(S).reverse() new StringBuffer(S).reverse new StringBuffer(S) String[] keys = {"dream", "dreamer", "erase", "eraser"}; keys {"dream", "dreamer", "erase", "eraser"} "dream" "dreamer" "erase" "eraser" boolean can = true; can true for (int i=0; i<S.length();) {
			boolean can2 = false;
			for (int j=0; j<4; j++) {
				String key = keys[j];
				key = new StringBuffer(key).reverse().toString();
				if ( i+key.length() > S.length() ) continue;
				if ( (S.substring(i, i+key.length())).equals(key) ){
					can2 = true;
					i+=key.length();
				}
			}
			if ( !can2 ) {
				can = false;
				break;
			}
		} int i=0; int i=0; i 0 i<S.length() i S.length() S.length S {
			boolean can2 = false;
			for (int j=0; j<4; j++) {
				String key = keys[j];
				key = new StringBuffer(key).reverse().toString();
				if ( i+key.length() > S.length() ) continue;
				if ( (S.substring(i, i+key.length())).equals(key) ){
					can2 = true;
					i+=key.length();
				}
			}
			if ( !can2 ) {
				can = false;
				break;
			}
		} {
			boolean can2 = false;
			for (int j=0; j<4; j++) {
				String key = keys[j];
				key = new StringBuffer(key).reverse().toString();
				if ( i+key.length() > S.length() ) continue;
				if ( (S.substring(i, i+key.length())).equals(key) ){
					can2 = true;
					i+=key.length();
				}
			}
			if ( !can2 ) {
				can = false;
				break;
			}
		} boolean can2 = false; can2 false for (int j=0; j<4; j++) {
				String key = keys[j];
				key = new StringBuffer(key).reverse().toString();
				if ( i+key.length() > S.length() ) continue;
				if ( (S.substring(i, i+key.length())).equals(key) ){
					can2 = true;
					i+=key.length();
				}
			} int j=0; int j=0; j 0 j<4 j 4 j++ j++ j {
				String key = keys[j];
				key = new StringBuffer(key).reverse().toString();
				if ( i+key.length() > S.length() ) continue;
				if ( (S.substring(i, i+key.length())).equals(key) ){
					can2 = true;
					i+=key.length();
				}
			} {
				String key = keys[j];
				key = new StringBuffer(key).reverse().toString();
				if ( i+key.length() > S.length() ) continue;
				if ( (S.substring(i, i+key.length())).equals(key) ){
					can2 = true;
					i+=key.length();
				}
			} String key = keys[j]; key keys[j] keys j key = new StringBuffer(key).reverse().toString() key new StringBuffer(key).reverse().toString() new StringBuffer(key).reverse().toString new StringBuffer(key).reverse() new StringBuffer(key).reverse new StringBuffer(key) if ( i+key.length() > S.length() ) continue; i+key.length() > S.length() i+key.length() i key.length() key.length key S.length() S.length S continue; if ( (S.substring(i, i+key.length())).equals(key) ){
					can2 = true;
					i+=key.length();
				} (S.substring(i, i+key.length())).equals(key) (S.substring(i, i+key.length())).equals (S.substring(i, i+key.length())) S.substring S i i+key.length() i key.length() key.length key key {
					can2 = true;
					i+=key.length();
				} can2 = true can2 true i+=key.length() i key.length() key.length key if ( !can2 ) {
				can = false;
				break;
			} !can2 can2 {
				can = false;
				break;
			} can = false can false break; if (can) System.out.println("YES");
		else System.out.println("NO"); can System.out.println("YES") System.out.println System.out System System.out "YES" 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 S = sc.next();
		S = new StringBuffer(S).reverse().toString();
		String[] keys = {"dream", "dreamer", "erase", "eraser"};
		boolean can = true;
		for (int i=0; i<S.length();) {
			boolean can2 = false;
			for (int j=0; j<4; j++) {
				String key = keys[j];
				key = new StringBuffer(key).reverse().toString();
				if ( i+key.length() > S.length() ) continue;
				if ( (S.substring(i, i+key.length())).equals(key) ){
					can2 = true;
					i+=key.length();
				}
			}
			if ( !can2 ) {
				can = false;
				break;
			}
		}
		if (can) 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 S = sc.next();
		S = new StringBuffer(S).reverse().toString();
		String[] keys = {"dream", "dreamer", "erase", "eraser"};
		boolean can = true;
		for (int i=0; i<S.length();) {
			boolean can2 = false;
			for (int j=0; j<4; j++) {
				String key = keys[j];
				key = new StringBuffer(key).reverse().toString();
				if ( i+key.length() > S.length() ) continue;
				if ( (S.substring(i, i+key.length())).equals(key) ){
					can2 = true;
					i+=key.length();
				}
			}
			if ( !can2 ) {
				can = false;
				break;
			}
		}
		if (can) 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 S = sc.next();
		S = new StringBuffer(S).reverse().toString();
		String[] keys = {"dream", "dreamer", "erase", "eraser"};
		boolean can = true;
		for (int i=0; i<S.length();) {
			boolean can2 = false;
			for (int j=0; j<4; j++) {
				String key = keys[j];
				key = new StringBuffer(key).reverse().toString();
				if ( i+key.length() > S.length() ) continue;
				if ( (S.substring(i, i+key.length())).equals(key) ){
					can2 = true;
					i+=key.length();
				}
			}
			if ( !can2 ) {
				can = false;
				break;
			}
		}
		if (can) System.out.println("YES");
		else System.out.println("NO");
	}
}
