import java.util.Scanner;
import java.util.regex.Pattern;

public class Main {

	/** 条件に満たす文字の正規表現 */
	private static final Pattern PATTERN = Pattern.compile("^(dream|dreamer|erase|eraser)+$");

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			String s = scanner.next();
			System.out.println(PATTERN.matcher(s).matches() ? "YES" : "NO");
		}
	}
} import java.util.Scanner; Scanner java.util import java.util.regex.Pattern; Pattern java.util.regex public class Main {

	/** 条件に満たす文字の正規表現 */
	private static final Pattern PATTERN = Pattern.compile("^(dream|dreamer|erase|eraser)+$");

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			String s = scanner.next();
			System.out.println(PATTERN.matcher(s).matches() ? "YES" : "NO");
		}
	}
} Main /** 条件に満たす文字の正規表現 */
	private static final Pattern PATTERN = Pattern.compile("^(dream|dreamer|erase|eraser)+$"); PATTERN Pattern.compile("^(dream|dreamer|erase|eraser)+$") Pattern.compile Pattern "^(dream|dreamer|erase|eraser)+$" public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			String s = scanner.next();
			System.out.println(PATTERN.matcher(s).matches() ? "YES" : "NO");
		}
	} main {
		try (Scanner scanner = new Scanner(System.in)) {
			String s = scanner.next();
			System.out.println(PATTERN.matcher(s).matches() ? "YES" : "NO");
		}
	} try (Scanner scanner = new Scanner(System.in)) {
			String s = scanner.next();
			System.out.println(PATTERN.matcher(s).matches() ? "YES" : "NO");
		} {
			String s = scanner.next();
			System.out.println(PATTERN.matcher(s).matches() ? "YES" : "NO");
		} Scanner scanner = new Scanner(System.in) Scanner scanner = new Scanner(System.in) new Scanner(System.in) String s = scanner.next(); s scanner.next() scanner.next scanner System.out.println(PATTERN.matcher(s).matches() ? "YES" : "NO") System.out.println System.out System System.out PATTERN.matcher(s).matches() ? "YES" : "NO" PATTERN.matcher(s).matches() PATTERN.matcher(s).matches PATTERN.matcher(s) PATTERN.matcher PATTERN s "YES" "NO" String[] args args public class Main {

	/** 条件に満たす文字の正規表現 */
	private static final Pattern PATTERN = Pattern.compile("^(dream|dreamer|erase|eraser)+$");

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			String s = scanner.next();
			System.out.println(PATTERN.matcher(s).matches() ? "YES" : "NO");
		}
	}
} public class Main {

	/** 条件に満たす文字の正規表現 */
	private static final Pattern PATTERN = Pattern.compile("^(dream|dreamer|erase|eraser)+$");

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			String s = scanner.next();
			System.out.println(PATTERN.matcher(s).matches() ? "YES" : "NO");
		}
	}
} Main
import java.util.Scanner;
import java.util.regex.Pattern;

public class Main {

	/** 条件に満たす文字の正規表現 */
	private static final Pattern PATTERN = Pattern.compile("^(dream|dreamer|erase|eraser)+$");

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			String s = scanner.next();
			System.out.println(PATTERN.matcher(s).matches() ? "YES" : "NO");
		}
	}
}
