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