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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb  = new StringBuilder(sc.next());

		List<StringBuilder> wordsList = new ArrayList<StringBuilder>();
		wordsList.add(new StringBuilder("dreamer"));
		wordsList.add(new StringBuilder("dream"));
		wordsList.add(new StringBuilder("erase"));
		wordsList.add(new StringBuilder("eraser"));

		sb = sb.reverse();
		for (StringBuilder word : wordsList) {
			word = word.reverse();
		}
		while (sb.length() > 0) {
			boolean hitFlg = false;

			for (StringBuilder word : wordsList) {
				if (sb.indexOf(word.toString()) == 0) {
					sb.delete(0, word.length());
					hitFlg = true;
					break;
				}
			}
			if (!hitFlg) {
				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 sc = new Scanner(System.in);
		StringBuilder sb  = new StringBuilder(sc.next());

		List<StringBuilder> wordsList = new ArrayList<StringBuilder>();
		wordsList.add(new StringBuilder("dreamer"));
		wordsList.add(new StringBuilder("dream"));
		wordsList.add(new StringBuilder("erase"));
		wordsList.add(new StringBuilder("eraser"));

		sb = sb.reverse();
		for (StringBuilder word : wordsList) {
			word = word.reverse();
		}
		while (sb.length() > 0) {
			boolean hitFlg = false;

			for (StringBuilder word : wordsList) {
				if (sb.indexOf(word.toString()) == 0) {
					sb.delete(0, word.length());
					hitFlg = true;
					break;
				}
			}
			if (!hitFlg) {
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb  = new StringBuilder(sc.next());

		List<StringBuilder> wordsList = new ArrayList<StringBuilder>();
		wordsList.add(new StringBuilder("dreamer"));
		wordsList.add(new StringBuilder("dream"));
		wordsList.add(new StringBuilder("erase"));
		wordsList.add(new StringBuilder("eraser"));

		sb = sb.reverse();
		for (StringBuilder word : wordsList) {
			word = word.reverse();
		}
		while (sb.length() > 0) {
			boolean hitFlg = false;

			for (StringBuilder word : wordsList) {
				if (sb.indexOf(word.toString()) == 0) {
					sb.delete(0, word.length());
					hitFlg = true;
					break;
				}
			}
			if (!hitFlg) {
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");
	} main {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb  = new StringBuilder(sc.next());

		List<StringBuilder> wordsList = new ArrayList<StringBuilder>();
		wordsList.add(new StringBuilder("dreamer"));
		wordsList.add(new StringBuilder("dream"));
		wordsList.add(new StringBuilder("erase"));
		wordsList.add(new StringBuilder("eraser"));

		sb = sb.reverse();
		for (StringBuilder word : wordsList) {
			word = word.reverse();
		}
		while (sb.length() > 0) {
			boolean hitFlg = false;

			for (StringBuilder word : wordsList) {
				if (sb.indexOf(word.toString()) == 0) {
					sb.delete(0, word.length());
					hitFlg = true;
					break;
				}
			}
			if (!hitFlg) {
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) StringBuilder sb  = new StringBuilder(sc.next()); sb new StringBuilder(sc.next()) List<StringBuilder> wordsList = new ArrayList<StringBuilder>(); wordsList new ArrayList<StringBuilder>() wordsList.add(new StringBuilder("dreamer")) wordsList.add wordsList new StringBuilder("dreamer") wordsList.add(new StringBuilder("dream")) wordsList.add wordsList new StringBuilder("dream") wordsList.add(new StringBuilder("erase")) wordsList.add wordsList new StringBuilder("erase") wordsList.add(new StringBuilder("eraser")) wordsList.add wordsList new StringBuilder("eraser") sb = sb.reverse() sb sb.reverse() sb.reverse sb for (StringBuilder word : wordsList) {
			word = word.reverse();
		} StringBuilder word wordsList {
			word = word.reverse();
		} {
			word = word.reverse();
		} word = word.reverse() word word.reverse() word.reverse word while (sb.length() > 0) {
			boolean hitFlg = false;

			for (StringBuilder word : wordsList) {
				if (sb.indexOf(word.toString()) == 0) {
					sb.delete(0, word.length());
					hitFlg = true;
					break;
				}
			}
			if (!hitFlg) {
				System.out.println("NO");
				return;
			}
		} sb.length() > 0 sb.length() sb.length sb 0 {
			boolean hitFlg = false;

			for (StringBuilder word : wordsList) {
				if (sb.indexOf(word.toString()) == 0) {
					sb.delete(0, word.length());
					hitFlg = true;
					break;
				}
			}
			if (!hitFlg) {
				System.out.println("NO");
				return;
			}
		} boolean hitFlg = false; hitFlg false for (StringBuilder word : wordsList) {
				if (sb.indexOf(word.toString()) == 0) {
					sb.delete(0, word.length());
					hitFlg = true;
					break;
				}
			} StringBuilder word wordsList {
				if (sb.indexOf(word.toString()) == 0) {
					sb.delete(0, word.length());
					hitFlg = true;
					break;
				}
			} {
				if (sb.indexOf(word.toString()) == 0) {
					sb.delete(0, word.length());
					hitFlg = true;
					break;
				}
			} if (sb.indexOf(word.toString()) == 0) {
					sb.delete(0, word.length());
					hitFlg = true;
					break;
				} sb.indexOf(word.toString()) == 0 sb.indexOf(word.toString()) sb.indexOf sb word.toString() word.toString word 0 {
					sb.delete(0, word.length());
					hitFlg = true;
					break;
				} sb.delete(0, word.length()) sb.delete sb 0 word.length() word.length word hitFlg = true hitFlg true break; if (!hitFlg) {
				System.out.println("NO");
				return;
			} !hitFlg hitFlg {
				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 sc = new Scanner(System.in);
		StringBuilder sb  = new StringBuilder(sc.next());

		List<StringBuilder> wordsList = new ArrayList<StringBuilder>();
		wordsList.add(new StringBuilder("dreamer"));
		wordsList.add(new StringBuilder("dream"));
		wordsList.add(new StringBuilder("erase"));
		wordsList.add(new StringBuilder("eraser"));

		sb = sb.reverse();
		for (StringBuilder word : wordsList) {
			word = word.reverse();
		}
		while (sb.length() > 0) {
			boolean hitFlg = false;

			for (StringBuilder word : wordsList) {
				if (sb.indexOf(word.toString()) == 0) {
					sb.delete(0, word.length());
					hitFlg = true;
					break;
				}
			}
			if (!hitFlg) {
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb  = new StringBuilder(sc.next());

		List<StringBuilder> wordsList = new ArrayList<StringBuilder>();
		wordsList.add(new StringBuilder("dreamer"));
		wordsList.add(new StringBuilder("dream"));
		wordsList.add(new StringBuilder("erase"));
		wordsList.add(new StringBuilder("eraser"));

		sb = sb.reverse();
		for (StringBuilder word : wordsList) {
			word = word.reverse();
		}
		while (sb.length() > 0) {
			boolean hitFlg = false;

			for (StringBuilder word : wordsList) {
				if (sb.indexOf(word.toString()) == 0) {
					sb.delete(0, word.length());
					hitFlg = true;
					break;
				}
			}
			if (!hitFlg) {
				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 sc = new Scanner(System.in);
		StringBuilder sb  = new StringBuilder(sc.next());

		List<StringBuilder> wordsList = new ArrayList<StringBuilder>();
		wordsList.add(new StringBuilder("dreamer"));
		wordsList.add(new StringBuilder("dream"));
		wordsList.add(new StringBuilder("erase"));
		wordsList.add(new StringBuilder("eraser"));

		sb = sb.reverse();
		for (StringBuilder word : wordsList) {
			word = word.reverse();
		}
		while (sb.length() > 0) {
			boolean hitFlg = false;

			for (StringBuilder word : wordsList) {
				if (sb.indexOf(word.toString()) == 0) {
					sb.delete(0, word.length());
					hitFlg = true;
					break;
				}
			}
			if (!hitFlg) {
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");
	}

}
