import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		String divide[] = { "dream", "dreamer", "erase", "eraser" };
		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		//すべての文字列を左右反転
		StringBuffer sb = new StringBuffer(s);
		s = sb.reverse().toString();
		//		System.out.println(s);
		for (int i = 0; i < 4; i++) {
			sb = new StringBuffer(divide[i]);
			divide[i] = sb.reverse().toString();
			//			System.out.println(divide[i]);
		}

		//端から切っていく
		boolean flg = true;
		for (int i = 0; i < s.length();) {
			boolean flg2 = false;//4この文字のうち、どれかでdevide出来るか判定
			for (int j = 0; j < 4; j++) {
				String d = divide[j];
//				System.out.println(s.substring(i, i + d.length()));
				if (s.length() >= i + d.length() && s.substring(i, i + d.length()).equals(d)) {//dでdivide出来るか
					flg2 = true;
					i += d.length();//divide出来たらiを進める
				}
			}
			if (!flg2) {//divide出来なかったら
				flg = false;
				break;
			}
		}

		if (flg) {
			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) {
		String divide[] = { "dream", "dreamer", "erase", "eraser" };
		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		//すべての文字列を左右反転
		StringBuffer sb = new StringBuffer(s);
		s = sb.reverse().toString();
		//		System.out.println(s);
		for (int i = 0; i < 4; i++) {
			sb = new StringBuffer(divide[i]);
			divide[i] = sb.reverse().toString();
			//			System.out.println(divide[i]);
		}

		//端から切っていく
		boolean flg = true;
		for (int i = 0; i < s.length();) {
			boolean flg2 = false;//4この文字のうち、どれかでdevide出来るか判定
			for (int j = 0; j < 4; j++) {
				String d = divide[j];
//				System.out.println(s.substring(i, i + d.length()));
				if (s.length() >= i + d.length() && s.substring(i, i + d.length()).equals(d)) {//dでdivide出来るか
					flg2 = true;
					i += d.length();//divide出来たらiを進める
				}
			}
			if (!flg2) {//divide出来なかったら
				flg = false;
				break;
			}
		}

		if (flg) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}

	}

} Main public static void main(String[] args) {
		String divide[] = { "dream", "dreamer", "erase", "eraser" };
		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		//すべての文字列を左右反転
		StringBuffer sb = new StringBuffer(s);
		s = sb.reverse().toString();
		//		System.out.println(s);
		for (int i = 0; i < 4; i++) {
			sb = new StringBuffer(divide[i]);
			divide[i] = sb.reverse().toString();
			//			System.out.println(divide[i]);
		}

		//端から切っていく
		boolean flg = true;
		for (int i = 0; i < s.length();) {
			boolean flg2 = false;//4この文字のうち、どれかでdevide出来るか判定
			for (int j = 0; j < 4; j++) {
				String d = divide[j];
//				System.out.println(s.substring(i, i + d.length()));
				if (s.length() >= i + d.length() && s.substring(i, i + d.length()).equals(d)) {//dでdivide出来るか
					flg2 = true;
					i += d.length();//divide出来たらiを進める
				}
			}
			if (!flg2) {//divide出来なかったら
				flg = false;
				break;
			}
		}

		if (flg) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}

	} main {
		String divide[] = { "dream", "dreamer", "erase", "eraser" };
		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		//すべての文字列を左右反転
		StringBuffer sb = new StringBuffer(s);
		s = sb.reverse().toString();
		//		System.out.println(s);
		for (int i = 0; i < 4; i++) {
			sb = new StringBuffer(divide[i]);
			divide[i] = sb.reverse().toString();
			//			System.out.println(divide[i]);
		}

		//端から切っていく
		boolean flg = true;
		for (int i = 0; i < s.length();) {
			boolean flg2 = false;//4この文字のうち、どれかでdevide出来るか判定
			for (int j = 0; j < 4; j++) {
				String d = divide[j];
//				System.out.println(s.substring(i, i + d.length()));
				if (s.length() >= i + d.length() && s.substring(i, i + d.length()).equals(d)) {//dでdivide出来るか
					flg2 = true;
					i += d.length();//divide出来たらiを進める
				}
			}
			if (!flg2) {//divide出来なかったら
				flg = false;
				break;
			}
		}

		if (flg) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}

	} String divide[] = { "dream", "dreamer", "erase", "eraser" }; divide { "dream", "dreamer", "erase", "eraser" } "dream" "dreamer" "erase" "eraser" Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc StringBuffer sb = new StringBuffer(s); sb new StringBuffer(s) s = sb.reverse().toString() s sb.reverse().toString() sb.reverse().toString sb.reverse() sb.reverse sb for (int i = 0; i < 4; i++) {
			sb = new StringBuffer(divide[i]);
			divide[i] = sb.reverse().toString();
			//			System.out.println(divide[i]);
		} int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
			sb = new StringBuffer(divide[i]);
			divide[i] = sb.reverse().toString();
			//			System.out.println(divide[i]);
		} {
			sb = new StringBuffer(divide[i]);
			divide[i] = sb.reverse().toString();
			//			System.out.println(divide[i]);
		} sb = new StringBuffer(divide[i]) sb new StringBuffer(divide[i]) divide[i] = sb.reverse().toString() divide[i] divide i sb.reverse().toString() sb.reverse().toString sb.reverse() sb.reverse sb boolean flg = true; flg true for (int i = 0; i < s.length();) {
			boolean flg2 = false;//4この文字のうち、どれかでdevide出来るか判定
			for (int j = 0; j < 4; j++) {
				String d = divide[j];
//				System.out.println(s.substring(i, i + d.length()));
				if (s.length() >= i + d.length() && s.substring(i, i + d.length()).equals(d)) {//dでdivide出来るか
					flg2 = true;
					i += d.length();//divide出来たらiを進める
				}
			}
			if (!flg2) {//divide出来なかったら
				flg = false;
				break;
			}
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s {
			boolean flg2 = false;//4この文字のうち、どれかでdevide出来るか判定
			for (int j = 0; j < 4; j++) {
				String d = divide[j];
//				System.out.println(s.substring(i, i + d.length()));
				if (s.length() >= i + d.length() && s.substring(i, i + d.length()).equals(d)) {//dでdivide出来るか
					flg2 = true;
					i += d.length();//divide出来たらiを進める
				}
			}
			if (!flg2) {//divide出来なかったら
				flg = false;
				break;
			}
		} {
			boolean flg2 = false;//4この文字のうち、どれかでdevide出来るか判定
			for (int j = 0; j < 4; j++) {
				String d = divide[j];
//				System.out.println(s.substring(i, i + d.length()));
				if (s.length() >= i + d.length() && s.substring(i, i + d.length()).equals(d)) {//dでdivide出来るか
					flg2 = true;
					i += d.length();//divide出来たらiを進める
				}
			}
			if (!flg2) {//divide出来なかったら
				flg = false;
				break;
			}
		} boolean flg2 = false; flg2 false for (int j = 0; j < 4; j++) {
				String d = divide[j];
//				System.out.println(s.substring(i, i + d.length()));
				if (s.length() >= i + d.length() && s.substring(i, i + d.length()).equals(d)) {//dでdivide出来るか
					flg2 = true;
					i += d.length();//divide出来たらiを進める
				}
			} int j = 0; int j = 0; j 0 j < 4 j 4 j++ j++ j {
				String d = divide[j];
//				System.out.println(s.substring(i, i + d.length()));
				if (s.length() >= i + d.length() && s.substring(i, i + d.length()).equals(d)) {//dでdivide出来るか
					flg2 = true;
					i += d.length();//divide出来たらiを進める
				}
			} {
				String d = divide[j];
//				System.out.println(s.substring(i, i + d.length()));
				if (s.length() >= i + d.length() && s.substring(i, i + d.length()).equals(d)) {//dでdivide出来るか
					flg2 = true;
					i += d.length();//divide出来たらiを進める
				}
			} String d = divide[j]; d divide[j] divide j if (s.length() >= i + d.length() && s.substring(i, i + d.length()).equals(d)) {//dでdivide出来るか
					flg2 = true;
					i += d.length();//divide出来たらiを進める
				} s.length() >= i + d.length() && s.substring(i, i + d.length()).equals(d) s.length() >= i + d.length() s.length() s.length s i + d.length() i d.length() d.length d s.substring(i, i + d.length()).equals(d) s.substring(i, i + d.length()).equals s.substring(i, i + d.length()) s.substring s i i + d.length() i d.length() d.length d d {//dでdivide出来るか
					flg2 = true;
					i += d.length();//divide出来たらiを進める
				} flg2 = true flg2 true i += d.length() i d.length() d.length d if (!flg2) {//divide出来なかったら
				flg = false;
				break;
			} !flg2 flg2 {//divide出来なかったら
				flg = false;
				break;
			} flg = false flg false break; if (flg) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		} flg {
			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) {
		String divide[] = { "dream", "dreamer", "erase", "eraser" };
		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		//すべての文字列を左右反転
		StringBuffer sb = new StringBuffer(s);
		s = sb.reverse().toString();
		//		System.out.println(s);
		for (int i = 0; i < 4; i++) {
			sb = new StringBuffer(divide[i]);
			divide[i] = sb.reverse().toString();
			//			System.out.println(divide[i]);
		}

		//端から切っていく
		boolean flg = true;
		for (int i = 0; i < s.length();) {
			boolean flg2 = false;//4この文字のうち、どれかでdevide出来るか判定
			for (int j = 0; j < 4; j++) {
				String d = divide[j];
//				System.out.println(s.substring(i, i + d.length()));
				if (s.length() >= i + d.length() && s.substring(i, i + d.length()).equals(d)) {//dでdivide出来るか
					flg2 = true;
					i += d.length();//divide出来たらiを進める
				}
			}
			if (!flg2) {//divide出来なかったら
				flg = false;
				break;
			}
		}

		if (flg) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}

	}

} public class Main {

	public static void main(String[] args) {
		String divide[] = { "dream", "dreamer", "erase", "eraser" };
		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		//すべての文字列を左右反転
		StringBuffer sb = new StringBuffer(s);
		s = sb.reverse().toString();
		//		System.out.println(s);
		for (int i = 0; i < 4; i++) {
			sb = new StringBuffer(divide[i]);
			divide[i] = sb.reverse().toString();
			//			System.out.println(divide[i]);
		}

		//端から切っていく
		boolean flg = true;
		for (int i = 0; i < s.length();) {
			boolean flg2 = false;//4この文字のうち、どれかでdevide出来るか判定
			for (int j = 0; j < 4; j++) {
				String d = divide[j];
//				System.out.println(s.substring(i, i + d.length()));
				if (s.length() >= i + d.length() && s.substring(i, i + d.length()).equals(d)) {//dでdivide出来るか
					flg2 = true;
					i += d.length();//divide出来たらiを進める
				}
			}
			if (!flg2) {//divide出来なかったら
				flg = false;
				break;
			}
		}

		if (flg) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		String divide[] = { "dream", "dreamer", "erase", "eraser" };
		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		//すべての文字列を左右反転
		StringBuffer sb = new StringBuffer(s);
		s = sb.reverse().toString();
		//		System.out.println(s);
		for (int i = 0; i < 4; i++) {
			sb = new StringBuffer(divide[i]);
			divide[i] = sb.reverse().toString();
			//			System.out.println(divide[i]);
		}

		//端から切っていく
		boolean flg = true;
		for (int i = 0; i < s.length();) {
			boolean flg2 = false;//4この文字のうち、どれかでdevide出来るか判定
			for (int j = 0; j < 4; j++) {
				String d = divide[j];
//				System.out.println(s.substring(i, i + d.length()));
				if (s.length() >= i + d.length() && s.substring(i, i + d.length()).equals(d)) {//dでdivide出来るか
					flg2 = true;
					i += d.length();//divide出来たらiを進める
				}
			}
			if (!flg2) {//divide出来なかったら
				flg = false;
				break;
			}
		}

		if (flg) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}

	}

}
