import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int len = S.length();
    String s1 = "dream";
    String s2 = "dreamer";
    String s3 = "erase";
    String s4 = "eraser";
    String ans = "YES";
    // dp[i]はSのインデックス0からi-1までの部分文字列に対する判定結果（出来るなら1、出来ないなら0）
    int[] dp = new int[len + 1];
    dp[0] = 1;
    for(int i = 5; i < len + 1; i++) {
      String str5 = "";
      String str6 = "";
      String str7 = "";
      if(i >= 5) {
        str5 = S.substring(i - 5, i);
        if(s1.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
        if(s3.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
      }
      if(i >= 6) {
        str6 = S.substring(i - 6, i);
        if(s4.equals(str6) && (dp[i - 6] == 1)) dp[i] = 1;
      }
      if(i >= 7) {
        str7 = S.substring(i - 7, i);
        if(s2.equals(str7) && (dp[i - 7] == 1)) dp[i] = 1;
      }
    }
    if(dp[len] == 0) ans = "NO";
    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();
    int len = S.length();
    String s1 = "dream";
    String s2 = "dreamer";
    String s3 = "erase";
    String s4 = "eraser";
    String ans = "YES";
    // dp[i]はSのインデックス0からi-1までの部分文字列に対する判定結果（出来るなら1、出来ないなら0）
    int[] dp = new int[len + 1];
    dp[0] = 1;
    for(int i = 5; i < len + 1; i++) {
      String str5 = "";
      String str6 = "";
      String str7 = "";
      if(i >= 5) {
        str5 = S.substring(i - 5, i);
        if(s1.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
        if(s3.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
      }
      if(i >= 6) {
        str6 = S.substring(i - 6, i);
        if(s4.equals(str6) && (dp[i - 6] == 1)) dp[i] = 1;
      }
      if(i >= 7) {
        str7 = S.substring(i - 7, i);
        if(s2.equals(str7) && (dp[i - 7] == 1)) dp[i] = 1;
      }
    }
    if(dp[len] == 0) ans = "NO";
    System.out.println(ans);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int len = S.length();
    String s1 = "dream";
    String s2 = "dreamer";
    String s3 = "erase";
    String s4 = "eraser";
    String ans = "YES";
    // dp[i]はSのインデックス0からi-1までの部分文字列に対する判定結果（出来るなら1、出来ないなら0）
    int[] dp = new int[len + 1];
    dp[0] = 1;
    for(int i = 5; i < len + 1; i++) {
      String str5 = "";
      String str6 = "";
      String str7 = "";
      if(i >= 5) {
        str5 = S.substring(i - 5, i);
        if(s1.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
        if(s3.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
      }
      if(i >= 6) {
        str6 = S.substring(i - 6, i);
        if(s4.equals(str6) && (dp[i - 6] == 1)) dp[i] = 1;
      }
      if(i >= 7) {
        str7 = S.substring(i - 7, i);
        if(s2.equals(str7) && (dp[i - 7] == 1)) dp[i] = 1;
      }
    }
    if(dp[len] == 0) ans = "NO";
    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int len = S.length();
    String s1 = "dream";
    String s2 = "dreamer";
    String s3 = "erase";
    String s4 = "eraser";
    String ans = "YES";
    // dp[i]はSのインデックス0からi-1までの部分文字列に対する判定結果（出来るなら1、出来ないなら0）
    int[] dp = new int[len + 1];
    dp[0] = 1;
    for(int i = 5; i < len + 1; i++) {
      String str5 = "";
      String str6 = "";
      String str7 = "";
      if(i >= 5) {
        str5 = S.substring(i - 5, i);
        if(s1.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
        if(s3.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
      }
      if(i >= 6) {
        str6 = S.substring(i - 6, i);
        if(s4.equals(str6) && (dp[i - 6] == 1)) dp[i] = 1;
      }
      if(i >= 7) {
        str7 = S.substring(i - 7, i);
        if(s2.equals(str7) && (dp[i - 7] == 1)) dp[i] = 1;
      }
    }
    if(dp[len] == 0) ans = "NO";
    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 int len = S.length(); len S.length() S.length S 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[] dp = new int[len + 1]; dp new int[len + 1] len + 1 len 1 dp[0] = 1 dp[0] dp 0 1 for(int i = 5; i < len + 1; i++) {
      String str5 = "";
      String str6 = "";
      String str7 = "";
      if(i >= 5) {
        str5 = S.substring(i - 5, i);
        if(s1.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
        if(s3.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
      }
      if(i >= 6) {
        str6 = S.substring(i - 6, i);
        if(s4.equals(str6) && (dp[i - 6] == 1)) dp[i] = 1;
      }
      if(i >= 7) {
        str7 = S.substring(i - 7, i);
        if(s2.equals(str7) && (dp[i - 7] == 1)) dp[i] = 1;
      }
    } int i = 5; int i = 5; i 5 i < len + 1 i len + 1 len 1 i++ i++ i {
      String str5 = "";
      String str6 = "";
      String str7 = "";
      if(i >= 5) {
        str5 = S.substring(i - 5, i);
        if(s1.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
        if(s3.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
      }
      if(i >= 6) {
        str6 = S.substring(i - 6, i);
        if(s4.equals(str6) && (dp[i - 6] == 1)) dp[i] = 1;
      }
      if(i >= 7) {
        str7 = S.substring(i - 7, i);
        if(s2.equals(str7) && (dp[i - 7] == 1)) dp[i] = 1;
      }
    } {
      String str5 = "";
      String str6 = "";
      String str7 = "";
      if(i >= 5) {
        str5 = S.substring(i - 5, i);
        if(s1.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
        if(s3.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
      }
      if(i >= 6) {
        str6 = S.substring(i - 6, i);
        if(s4.equals(str6) && (dp[i - 6] == 1)) dp[i] = 1;
      }
      if(i >= 7) {
        str7 = S.substring(i - 7, i);
        if(s2.equals(str7) && (dp[i - 7] == 1)) dp[i] = 1;
      }
    } String str5 = ""; str5 "" String str6 = ""; str6 "" String str7 = ""; str7 "" if(i >= 5) {
        str5 = S.substring(i - 5, i);
        if(s1.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
        if(s3.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
      } i >= 5 i 5 {
        str5 = S.substring(i - 5, i);
        if(s1.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
        if(s3.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
      } str5 = S.substring(i - 5, i) str5 S.substring(i - 5, i) S.substring S i - 5 i 5 i if(s1.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1; s1.equals(str5) && (dp[i - 5] == 1) s1.equals(str5) s1.equals s1 str5 (dp[i - 5] == 1) dp[i - 5] dp i - 5 i 5 1 dp[i] = 1 dp[i] dp i 1 if(s3.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1; s3.equals(str5) && (dp[i - 5] == 1) s3.equals(str5) s3.equals s3 str5 (dp[i - 5] == 1) dp[i - 5] dp i - 5 i 5 1 dp[i] = 1 dp[i] dp i 1 if(i >= 6) {
        str6 = S.substring(i - 6, i);
        if(s4.equals(str6) && (dp[i - 6] == 1)) dp[i] = 1;
      } i >= 6 i 6 {
        str6 = S.substring(i - 6, i);
        if(s4.equals(str6) && (dp[i - 6] == 1)) dp[i] = 1;
      } str6 = S.substring(i - 6, i) str6 S.substring(i - 6, i) S.substring S i - 6 i 6 i if(s4.equals(str6) && (dp[i - 6] == 1)) dp[i] = 1; s4.equals(str6) && (dp[i - 6] == 1) s4.equals(str6) s4.equals s4 str6 (dp[i - 6] == 1) dp[i - 6] dp i - 6 i 6 1 dp[i] = 1 dp[i] dp i 1 if(i >= 7) {
        str7 = S.substring(i - 7, i);
        if(s2.equals(str7) && (dp[i - 7] == 1)) dp[i] = 1;
      } i >= 7 i 7 {
        str7 = S.substring(i - 7, i);
        if(s2.equals(str7) && (dp[i - 7] == 1)) dp[i] = 1;
      } str7 = S.substring(i - 7, i) str7 S.substring(i - 7, i) S.substring S i - 7 i 7 i if(s2.equals(str7) && (dp[i - 7] == 1)) dp[i] = 1; s2.equals(str7) && (dp[i - 7] == 1) s2.equals(str7) s2.equals s2 str7 (dp[i - 7] == 1) dp[i - 7] dp i - 7 i 7 1 dp[i] = 1 dp[i] dp i 1 if(dp[len] == 0) ans = "NO"; dp[len] == 0 dp[len] dp len 0 ans = "NO" ans "NO" 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();
    int len = S.length();
    String s1 = "dream";
    String s2 = "dreamer";
    String s3 = "erase";
    String s4 = "eraser";
    String ans = "YES";
    // dp[i]はSのインデックス0からi-1までの部分文字列に対する判定結果（出来るなら1、出来ないなら0）
    int[] dp = new int[len + 1];
    dp[0] = 1;
    for(int i = 5; i < len + 1; i++) {
      String str5 = "";
      String str6 = "";
      String str7 = "";
      if(i >= 5) {
        str5 = S.substring(i - 5, i);
        if(s1.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
        if(s3.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
      }
      if(i >= 6) {
        str6 = S.substring(i - 6, i);
        if(s4.equals(str6) && (dp[i - 6] == 1)) dp[i] = 1;
      }
      if(i >= 7) {
        str7 = S.substring(i - 7, i);
        if(s2.equals(str7) && (dp[i - 7] == 1)) dp[i] = 1;
      }
    }
    if(dp[len] == 0) ans = "NO";
    System.out.println(ans);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int len = S.length();
    String s1 = "dream";
    String s2 = "dreamer";
    String s3 = "erase";
    String s4 = "eraser";
    String ans = "YES";
    // dp[i]はSのインデックス0からi-1までの部分文字列に対する判定結果（出来るなら1、出来ないなら0）
    int[] dp = new int[len + 1];
    dp[0] = 1;
    for(int i = 5; i < len + 1; i++) {
      String str5 = "";
      String str6 = "";
      String str7 = "";
      if(i >= 5) {
        str5 = S.substring(i - 5, i);
        if(s1.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
        if(s3.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
      }
      if(i >= 6) {
        str6 = S.substring(i - 6, i);
        if(s4.equals(str6) && (dp[i - 6] == 1)) dp[i] = 1;
      }
      if(i >= 7) {
        str7 = S.substring(i - 7, i);
        if(s2.equals(str7) && (dp[i - 7] == 1)) dp[i] = 1;
      }
    }
    if(dp[len] == 0) ans = "NO";
    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();
    int len = S.length();
    String s1 = "dream";
    String s2 = "dreamer";
    String s3 = "erase";
    String s4 = "eraser";
    String ans = "YES";
    // dp[i]はSのインデックス0からi-1までの部分文字列に対する判定結果（出来るなら1、出来ないなら0）
    int[] dp = new int[len + 1];
    dp[0] = 1;
    for(int i = 5; i < len + 1; i++) {
      String str5 = "";
      String str6 = "";
      String str7 = "";
      if(i >= 5) {
        str5 = S.substring(i - 5, i);
        if(s1.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
        if(s3.equals(str5) && (dp[i - 5] == 1)) dp[i] = 1;
      }
      if(i >= 6) {
        str6 = S.substring(i - 6, i);
        if(s4.equals(str6) && (dp[i - 6] == 1)) dp[i] = 1;
      }
      if(i >= 7) {
        str7 = S.substring(i - 7, i);
        if(s2.equals(str7) && (dp[i - 7] == 1)) dp[i] = 1;
      }
    }
    if(dp[len] == 0) ans = "NO";
    System.out.println(ans);
  }
}