import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		Set<String> m = new HashSet<>();
		m.add("eraser");
		m.add("dreamer");
		m.add("dream");
		m.add("erase");
		boolean[] a = new boolean[s.length() + 1];
		a[0] = true;
		for (int i = 5; i <= s.length(); i++) {
			if (a[i - 5] && m.contains(s.substring(i - 5, i))) a[i] = true;
			if (i - 6 >= 0 && a[i - 6] && m.contains(s.substring(i - 6, i))) a[i] = true;
			if (i - 7 >= 0 && a[i - 7] && m.contains(s.substring(i - 7, i))) a[i] = true;
		}

		if (a[s.length()]) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
} import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util import java.util.Set; Set java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		Set<String> m = new HashSet<>();
		m.add("eraser");
		m.add("dreamer");
		m.add("dream");
		m.add("erase");
		boolean[] a = new boolean[s.length() + 1];
		a[0] = true;
		for (int i = 5; i <= s.length(); i++) {
			if (a[i - 5] && m.contains(s.substring(i - 5, i))) a[i] = true;
			if (i - 6 >= 0 && a[i - 6] && m.contains(s.substring(i - 6, i))) a[i] = true;
			if (i - 7 >= 0 && a[i - 7] && m.contains(s.substring(i - 7, i))) a[i] = true;
		}

		if (a[s.length()]) {
			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.nextLine();
		Set<String> m = new HashSet<>();
		m.add("eraser");
		m.add("dreamer");
		m.add("dream");
		m.add("erase");
		boolean[] a = new boolean[s.length() + 1];
		a[0] = true;
		for (int i = 5; i <= s.length(); i++) {
			if (a[i - 5] && m.contains(s.substring(i - 5, i))) a[i] = true;
			if (i - 6 >= 0 && a[i - 6] && m.contains(s.substring(i - 6, i))) a[i] = true;
			if (i - 7 >= 0 && a[i - 7] && m.contains(s.substring(i - 7, i))) a[i] = true;
		}

		if (a[s.length()]) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		Set<String> m = new HashSet<>();
		m.add("eraser");
		m.add("dreamer");
		m.add("dream");
		m.add("erase");
		boolean[] a = new boolean[s.length() + 1];
		a[0] = true;
		for (int i = 5; i <= s.length(); i++) {
			if (a[i - 5] && m.contains(s.substring(i - 5, i))) a[i] = true;
			if (i - 6 >= 0 && a[i - 6] && m.contains(s.substring(i - 6, i))) a[i] = true;
			if (i - 7 >= 0 && a[i - 7] && m.contains(s.substring(i - 7, i))) a[i] = true;
		}

		if (a[s.length()]) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc Set<String> m = new HashSet<>(); m new HashSet<>() m.add("eraser") m.add m "eraser" m.add("dreamer") m.add m "dreamer" m.add("dream") m.add m "dream" m.add("erase") m.add m "erase" boolean[] a = new boolean[s.length() + 1]; a new boolean[s.length() + 1] s.length() + 1 s.length() s.length s 1 a[0] = true a[0] a 0 true for (int i = 5; i <= s.length(); i++) {
			if (a[i - 5] && m.contains(s.substring(i - 5, i))) a[i] = true;
			if (i - 6 >= 0 && a[i - 6] && m.contains(s.substring(i - 6, i))) a[i] = true;
			if (i - 7 >= 0 && a[i - 7] && m.contains(s.substring(i - 7, i))) a[i] = true;
		} int i = 5; int i = 5; i 5 i <= s.length() i s.length() s.length s i++ i++ i {
			if (a[i - 5] && m.contains(s.substring(i - 5, i))) a[i] = true;
			if (i - 6 >= 0 && a[i - 6] && m.contains(s.substring(i - 6, i))) a[i] = true;
			if (i - 7 >= 0 && a[i - 7] && m.contains(s.substring(i - 7, i))) a[i] = true;
		} {
			if (a[i - 5] && m.contains(s.substring(i - 5, i))) a[i] = true;
			if (i - 6 >= 0 && a[i - 6] && m.contains(s.substring(i - 6, i))) a[i] = true;
			if (i - 7 >= 0 && a[i - 7] && m.contains(s.substring(i - 7, i))) a[i] = true;
		} if (a[i - 5] && m.contains(s.substring(i - 5, i))) a[i] = true; a[i - 5] && m.contains(s.substring(i - 5, i)) a[i - 5] a i - 5 i 5 m.contains(s.substring(i - 5, i)) m.contains m s.substring(i - 5, i) s.substring s i - 5 i 5 i a[i] = true a[i] a i true if (i - 6 >= 0 && a[i - 6] && m.contains(s.substring(i - 6, i))) a[i] = true; i - 6 >= 0 && a[i - 6] && m.contains(s.substring(i - 6, i)) i - 6 >= 0 && a[i - 6] && m.contains(s.substring(i - 6, i)) i - 6 >= 0 i - 6 i 6 0 a[i - 6] a i - 6 i 6 m.contains(s.substring(i - 6, i)) m.contains m s.substring(i - 6, i) s.substring s i - 6 i 6 i a[i] = true a[i] a i true if (i - 7 >= 0 && a[i - 7] && m.contains(s.substring(i - 7, i))) a[i] = true; i - 7 >= 0 && a[i - 7] && m.contains(s.substring(i - 7, i)) i - 7 >= 0 && a[i - 7] && m.contains(s.substring(i - 7, i)) i - 7 >= 0 i - 7 i 7 0 a[i - 7] a i - 7 i 7 m.contains(s.substring(i - 7, i)) m.contains m s.substring(i - 7, i) s.substring s i - 7 i 7 i a[i] = true a[i] a i true if (a[s.length()]) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		} a[s.length()] a s.length() s.length s {
			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) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		Set<String> m = new HashSet<>();
		m.add("eraser");
		m.add("dreamer");
		m.add("dream");
		m.add("erase");
		boolean[] a = new boolean[s.length() + 1];
		a[0] = true;
		for (int i = 5; i <= s.length(); i++) {
			if (a[i - 5] && m.contains(s.substring(i - 5, i))) a[i] = true;
			if (i - 6 >= 0 && a[i - 6] && m.contains(s.substring(i - 6, i))) a[i] = true;
			if (i - 7 >= 0 && a[i - 7] && m.contains(s.substring(i - 7, i))) a[i] = true;
		}

		if (a[s.length()]) {
			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.nextLine();
		Set<String> m = new HashSet<>();
		m.add("eraser");
		m.add("dreamer");
		m.add("dream");
		m.add("erase");
		boolean[] a = new boolean[s.length() + 1];
		a[0] = true;
		for (int i = 5; i <= s.length(); i++) {
			if (a[i - 5] && m.contains(s.substring(i - 5, i))) a[i] = true;
			if (i - 6 >= 0 && a[i - 6] && m.contains(s.substring(i - 6, i))) a[i] = true;
			if (i - 7 >= 0 && a[i - 7] && m.contains(s.substring(i - 7, i))) a[i] = true;
		}

		if (a[s.length()]) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
} Main
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		Set<String> m = new HashSet<>();
		m.add("eraser");
		m.add("dreamer");
		m.add("dream");
		m.add("erase");
		boolean[] a = new boolean[s.length() + 1];
		a[0] = true;
		for (int i = 5; i <= s.length(); i++) {
			if (a[i - 5] && m.contains(s.substring(i - 5, i))) a[i] = true;
			if (i - 6 >= 0 && a[i - 6] && m.contains(s.substring(i - 6, i))) a[i] = true;
			if (i - 7 >= 0 && a[i - 7] && m.contains(s.substring(i - 7, i))) a[i] = true;
		}

		if (a[s.length()]) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}
