import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    //for(int i = S.length() - 1; i >= 0; i--) {
      //inverse += String.valueOf(S.charAt(i));
    //}
    String s1 = "dream";
    String s2 = "dreamer";
    String s3 = "erase";
    String s4 = "eraser";
    String ans = "YES";
    int pos = S.length();
    while(pos > 0 ) {
      String str5 = "";
      String str6 = "";
      String str7 = "";
      if(pos - 5 >= 0) {
        str5 = S.substring(pos - 5,pos);
      }
      if(pos - 6 >= 0) {
        str6 = S.substring(pos - 6,pos);
      }
      if(pos - 7 >= 0) {
        str7 = S.substring(pos - 7,pos);
      }
      if((pos - 5 >= 0) && (s1.equals(str5))) {
        pos -= 5;
      } else if((pos - 7 >=0) && (s2.equals(str7))) {
        pos -= 7;
      } else if((pos - 5 >=0) && (s3.equals(str5))) {
        pos -= 5;
      } else if((pos - 6 >=0) && (s4.equals(str6))) {
        pos -= 6;
      } else {
        ans = "NO";
        break;
      }     
    }
    System.out.println(ans);
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    //for(int i = S.length() - 1; i >= 0; i--) {
      //inverse += String.valueOf(S.charAt(i));
    //}
    String s1 = "dream";
    String s2 = "dreamer";
    String s3 = "erase";
    String s4 = "eraser";
    String ans = "YES";
    int pos = S.length();
    while(pos > 0 ) {
      String str5 = "";
      String str6 = "";
      String str7 = "";
      if(pos - 5 >= 0) {
        str5 = S.substring(pos - 5,pos);
      }
      if(pos - 6 >= 0) {
        str6 = S.substring(pos - 6,pos);
      }
      if(pos - 7 >= 0) {
        str7 = S.substring(pos - 7,pos);
      }
      if((pos - 5 >= 0) && (s1.equals(str5))) {
        pos -= 5;
      } else if((pos - 7 >=0) && (s2.equals(str7))) {
        pos -= 7;
      } else if((pos - 5 >=0) && (s3.equals(str5))) {
        pos -= 5;
      } else if((pos - 6 >=0) && (s4.equals(str6))) {
        pos -= 6;
      } else {
        ans = "NO";
        break;
      }     
    }
    System.out.println(ans);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    //for(int i = S.length() - 1; i >= 0; i--) {
      //inverse += String.valueOf(S.charAt(i));
    //}
    String s1 = "dream";
    String s2 = "dreamer";
    String s3 = "erase";
    String s4 = "eraser";
    String ans = "YES";
    int pos = S.length();
    while(pos > 0 ) {
      String str5 = "";
      String str6 = "";
      String str7 = "";
      if(pos - 5 >= 0) {
        str5 = S.substring(pos - 5,pos);
      }
      if(pos - 6 >= 0) {
        str6 = S.substring(pos - 6,pos);
      }
      if(pos - 7 >= 0) {
        str7 = S.substring(pos - 7,pos);
      }
      if((pos - 5 >= 0) && (s1.equals(str5))) {
        pos -= 5;
      } else if((pos - 7 >=0) && (s2.equals(str7))) {
        pos -= 7;
      } else if((pos - 5 >=0) && (s3.equals(str5))) {
        pos -= 5;
      } else if((pos - 6 >=0) && (s4.equals(str6))) {
        pos -= 6;
      } else {
        ans = "NO";
        break;
      }     
    }
    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    //for(int i = S.length() - 1; i >= 0; i--) {
      //inverse += String.valueOf(S.charAt(i));
    //}
    String s1 = "dream";
    String s2 = "dreamer";
    String s3 = "erase";
    String s4 = "eraser";
    String ans = "YES";
    int pos = S.length();
    while(pos > 0 ) {
      String str5 = "";
      String str6 = "";
      String str7 = "";
      if(pos - 5 >= 0) {
        str5 = S.substring(pos - 5,pos);
      }
      if(pos - 6 >= 0) {
        str6 = S.substring(pos - 6,pos);
      }
      if(pos - 7 >= 0) {
        str7 = S.substring(pos - 7,pos);
      }
      if((pos - 5 >= 0) && (s1.equals(str5))) {
        pos -= 5;
      } else if((pos - 7 >=0) && (s2.equals(str7))) {
        pos -= 7;
      } else if((pos - 5 >=0) && (s3.equals(str5))) {
        pos -= 5;
      } else if((pos - 6 >=0) && (s4.equals(str6))) {
        pos -= 6;
      } else {
        ans = "NO";
        break;
      }     
    }
    System.out.println(ans);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String s1 = "dream"; s1 "dream" String s2 = "dreamer"; s2 "dreamer" String s3 = "erase"; s3 "erase" String s4 = "eraser"; s4 "eraser" String ans = "YES"; ans "YES" int pos = S.length(); pos S.length() S.length S while(pos > 0 ) {
      String str5 = "";
      String str6 = "";
      String str7 = "";
      if(pos - 5 >= 0) {
        str5 = S.substring(pos - 5,pos);
      }
      if(pos - 6 >= 0) {
        str6 = S.substring(pos - 6,pos);
      }
      if(pos - 7 >= 0) {
        str7 = S.substring(pos - 7,pos);
      }
      if((pos - 5 >= 0) && (s1.equals(str5))) {
        pos -= 5;
      } else if((pos - 7 >=0) && (s2.equals(str7))) {
        pos -= 7;
      } else if((pos - 5 >=0) && (s3.equals(str5))) {
        pos -= 5;
      } else if((pos - 6 >=0) && (s4.equals(str6))) {
        pos -= 6;
      } else {
        ans = "NO";
        break;
      }     
    } pos > 0 pos 0 {
      String str5 = "";
      String str6 = "";
      String str7 = "";
      if(pos - 5 >= 0) {
        str5 = S.substring(pos - 5,pos);
      }
      if(pos - 6 >= 0) {
        str6 = S.substring(pos - 6,pos);
      }
      if(pos - 7 >= 0) {
        str7 = S.substring(pos - 7,pos);
      }
      if((pos - 5 >= 0) && (s1.equals(str5))) {
        pos -= 5;
      } else if((pos - 7 >=0) && (s2.equals(str7))) {
        pos -= 7;
      } else if((pos - 5 >=0) && (s3.equals(str5))) {
        pos -= 5;
      } else if((pos - 6 >=0) && (s4.equals(str6))) {
        pos -= 6;
      } else {
        ans = "NO";
        break;
      }     
    } String str5 = ""; str5 "" String str6 = ""; str6 "" String str7 = ""; str7 "" if(pos - 5 >= 0) {
        str5 = S.substring(pos - 5,pos);
      } pos - 5 >= 0 pos - 5 pos 5 0 {
        str5 = S.substring(pos - 5,pos);
      } str5 = S.substring(pos - 5,pos) str5 S.substring(pos - 5,pos) S.substring S pos - 5 pos 5 pos if(pos - 6 >= 0) {
        str6 = S.substring(pos - 6,pos);
      } pos - 6 >= 0 pos - 6 pos 6 0 {
        str6 = S.substring(pos - 6,pos);
      } str6 = S.substring(pos - 6,pos) str6 S.substring(pos - 6,pos) S.substring S pos - 6 pos 6 pos if(pos - 7 >= 0) {
        str7 = S.substring(pos - 7,pos);
      } pos - 7 >= 0 pos - 7 pos 7 0 {
        str7 = S.substring(pos - 7,pos);
      } str7 = S.substring(pos - 7,pos) str7 S.substring(pos - 7,pos) S.substring S pos - 7 pos 7 pos if((pos - 5 >= 0) && (s1.equals(str5))) {
        pos -= 5;
      } else if((pos - 7 >=0) && (s2.equals(str7))) {
        pos -= 7;
      } else if((pos - 5 >=0) && (s3.equals(str5))) {
        pos -= 5;
      } else if((pos - 6 >=0) && (s4.equals(str6))) {
        pos -= 6;
      } else {
        ans = "NO";
        break;
      } (pos - 5 >= 0) && (s1.equals(str5)) (pos - 5 >= 0) pos - 5 pos 5 0 (s1.equals(str5)) s1.equals s1 str5 {
        pos -= 5;
      } pos -= 5 pos 5 if((pos - 7 >=0) && (s2.equals(str7))) {
        pos -= 7;
      } else if((pos - 5 >=0) && (s3.equals(str5))) {
        pos -= 5;
      } else if((pos - 6 >=0) && (s4.equals(str6))) {
        pos -= 6;
      } else {
        ans = "NO";
        break;
      } (pos - 7 >=0) && (s2.equals(str7)) (pos - 7 >=0) pos - 7 pos 7 0 (s2.equals(str7)) s2.equals s2 str7 {
        pos -= 7;
      } pos -= 7 pos 7 if((pos - 5 >=0) && (s3.equals(str5))) {
        pos -= 5;
      } else if((pos - 6 >=0) && (s4.equals(str6))) {
        pos -= 6;
      } else {
        ans = "NO";
        break;
      } (pos - 5 >=0) && (s3.equals(str5)) (pos - 5 >=0) pos - 5 pos 5 0 (s3.equals(str5)) s3.equals s3 str5 {
        pos -= 5;
      } pos -= 5 pos 5 if((pos - 6 >=0) && (s4.equals(str6))) {
        pos -= 6;
      } else {
        ans = "NO";
        break;
      } (pos - 6 >=0) && (s4.equals(str6)) (pos - 6 >=0) pos - 6 pos 6 0 (s4.equals(str6)) s4.equals s4 str6 {
        pos -= 6;
      } pos -= 6 pos 6 {
        ans = "NO";
        break;
      } ans = "NO" ans "NO" break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    //for(int i = S.length() - 1; i >= 0; i--) {
      //inverse += String.valueOf(S.charAt(i));
    //}
    String s1 = "dream";
    String s2 = "dreamer";
    String s3 = "erase";
    String s4 = "eraser";
    String ans = "YES";
    int pos = S.length();
    while(pos > 0 ) {
      String str5 = "";
      String str6 = "";
      String str7 = "";
      if(pos - 5 >= 0) {
        str5 = S.substring(pos - 5,pos);
      }
      if(pos - 6 >= 0) {
        str6 = S.substring(pos - 6,pos);
      }
      if(pos - 7 >= 0) {
        str7 = S.substring(pos - 7,pos);
      }
      if((pos - 5 >= 0) && (s1.equals(str5))) {
        pos -= 5;
      } else if((pos - 7 >=0) && (s2.equals(str7))) {
        pos -= 7;
      } else if((pos - 5 >=0) && (s3.equals(str5))) {
        pos -= 5;
      } else if((pos - 6 >=0) && (s4.equals(str6))) {
        pos -= 6;
      } else {
        ans = "NO";
        break;
      }     
    }
    System.out.println(ans);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    //for(int i = S.length() - 1; i >= 0; i--) {
      //inverse += String.valueOf(S.charAt(i));
    //}
    String s1 = "dream";
    String s2 = "dreamer";
    String s3 = "erase";
    String s4 = "eraser";
    String ans = "YES";
    int pos = S.length();
    while(pos > 0 ) {
      String str5 = "";
      String str6 = "";
      String str7 = "";
      if(pos - 5 >= 0) {
        str5 = S.substring(pos - 5,pos);
      }
      if(pos - 6 >= 0) {
        str6 = S.substring(pos - 6,pos);
      }
      if(pos - 7 >= 0) {
        str7 = S.substring(pos - 7,pos);
      }
      if((pos - 5 >= 0) && (s1.equals(str5))) {
        pos -= 5;
      } else if((pos - 7 >=0) && (s2.equals(str7))) {
        pos -= 7;
      } else if((pos - 5 >=0) && (s3.equals(str5))) {
        pos -= 5;
      } else if((pos - 6 >=0) && (s4.equals(str6))) {
        pos -= 6;
      } else {
        ans = "NO";
        break;
      }     
    }
    System.out.println(ans);
  }
} Main
import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    //for(int i = S.length() - 1; i >= 0; i--) {
      //inverse += String.valueOf(S.charAt(i));
    //}
    String s1 = "dream";
    String s2 = "dreamer";
    String s3 = "erase";
    String s4 = "eraser";
    String ans = "YES";
    int pos = S.length();
    while(pos > 0 ) {
      String str5 = "";
      String str6 = "";
      String str7 = "";
      if(pos - 5 >= 0) {
        str5 = S.substring(pos - 5,pos);
      }
      if(pos - 6 >= 0) {
        str6 = S.substring(pos - 6,pos);
      }
      if(pos - 7 >= 0) {
        str7 = S.substring(pos - 7,pos);
      }
      if((pos - 5 >= 0) && (s1.equals(str5))) {
        pos -= 5;
      } else if((pos - 7 >=0) && (s2.equals(str7))) {
        pos -= 7;
      } else if((pos - 5 >=0) && (s3.equals(str5))) {
        pos -= 5;
      } else if((pos - 6 >=0) && (s4.equals(str6))) {
        pos -= 6;
      } else {
        ans = "NO";
        break;
      }     
    }
    System.out.println(ans);
  }
}