import java.util.*;

public class Main{
   public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
  		String t = scanner.nextLine();
  		String t1 = t.replaceAll("eraser", "");
        String t2 = t1.replaceAll("erase", "");
        String t3 = t2.replaceAll("dreamer", "");
        String t4 = t3.replaceAll("dream", "");
     boolean flag = false;	
      if(t4.isEmpty()){
      System.out.println("YES");
      }else{
      System.out.println("NO");
        }
      }
   } import java.util.*; util.* java public class Main{
   public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
  		String t = scanner.nextLine();
  		String t1 = t.replaceAll("eraser", "");
        String t2 = t1.replaceAll("erase", "");
        String t3 = t2.replaceAll("dreamer", "");
        String t4 = t3.replaceAll("dream", "");
     boolean flag = false;	
      if(t4.isEmpty()){
      System.out.println("YES");
      }else{
      System.out.println("NO");
        }
      }
   } Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
  		String t = scanner.nextLine();
  		String t1 = t.replaceAll("eraser", "");
        String t2 = t1.replaceAll("erase", "");
        String t3 = t2.replaceAll("dreamer", "");
        String t4 = t3.replaceAll("dream", "");
     boolean flag = false;	
      if(t4.isEmpty()){
      System.out.println("YES");
      }else{
      System.out.println("NO");
        }
      } main {
		Scanner scanner = new Scanner(System.in);
  		String t = scanner.nextLine();
  		String t1 = t.replaceAll("eraser", "");
        String t2 = t1.replaceAll("erase", "");
        String t3 = t2.replaceAll("dreamer", "");
        String t4 = t3.replaceAll("dream", "");
     boolean flag = false;	
      if(t4.isEmpty()){
      System.out.println("YES");
      }else{
      System.out.println("NO");
        }
      } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String t = scanner.nextLine(); t scanner.nextLine() scanner.nextLine scanner String t1 = t.replaceAll("eraser", ""); t1 t.replaceAll("eraser", "") t.replaceAll t "eraser" "" String t2 = t1.replaceAll("erase", ""); t2 t1.replaceAll("erase", "") t1.replaceAll t1 "erase" "" String t3 = t2.replaceAll("dreamer", ""); t3 t2.replaceAll("dreamer", "") t2.replaceAll t2 "dreamer" "" String t4 = t3.replaceAll("dream", ""); t4 t3.replaceAll("dream", "") t3.replaceAll t3 "dream" "" boolean flag = false; flag false if(t4.isEmpty()){
      System.out.println("YES");
      }else{
      System.out.println("NO");
        } t4.isEmpty() t4.isEmpty t4 {
      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 scanner = new Scanner(System.in);
  		String t = scanner.nextLine();
  		String t1 = t.replaceAll("eraser", "");
        String t2 = t1.replaceAll("erase", "");
        String t3 = t2.replaceAll("dreamer", "");
        String t4 = t3.replaceAll("dream", "");
     boolean flag = false;	
      if(t4.isEmpty()){
      System.out.println("YES");
      }else{
      System.out.println("NO");
        }
      }
   } public class Main{
   public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
  		String t = scanner.nextLine();
  		String t1 = t.replaceAll("eraser", "");
        String t2 = t1.replaceAll("erase", "");
        String t3 = t2.replaceAll("dreamer", "");
        String t4 = t3.replaceAll("dream", "");
     boolean flag = false;	
      if(t4.isEmpty()){
      System.out.println("YES");
      }else{
      System.out.println("NO");
        }
      }
   } Main
import java.util.*;

public class Main{
   public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
  		String t = scanner.nextLine();
  		String t1 = t.replaceAll("eraser", "");
        String t2 = t1.replaceAll("erase", "");
        String t3 = t2.replaceAll("dreamer", "");
        String t4 = t3.replaceAll("dream", "");
     boolean flag = false;	
      if(t4.isEmpty()){
      System.out.println("YES");
      }else{
      System.out.println("NO");
        }
      }
   }