import java.util.Scanner;

public class Main {
  static String str;

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    str = sc.next();
    int n = str.length();

    boolean[] dp = new boolean[n + 1];
    dp[0] = true;
    for(int i = 5; i <= n; i++){
      if(str.substring(i - 5, i).equals("dream")){
        dp[i] |= dp[i - 5];
      }
      if(str.substring(i - 5, i).equals("erase")){
        dp[i] |= dp[i - 5];
      }
      if(i - 7 >= 0 
        && str.substring(i - 7, i).equals("dreamer")){
          dp[i] |= dp[i - 7];
      }
      if(i - 6 >= 0
        && str.substring(i - 6, i).equals("eraser")){
        dp[i] |= dp[i - 6];
      }
    }

    if(dp[n]){
      System.out.println("YES");
    }
    else{
      System.out.println("NO");
    }
  }
} import java.util.Scanner; Scanner java.util public class Main {
  static String str;

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    str = sc.next();
    int n = str.length();

    boolean[] dp = new boolean[n + 1];
    dp[0] = true;
    for(int i = 5; i <= n; i++){
      if(str.substring(i - 5, i).equals("dream")){
        dp[i] |= dp[i - 5];
      }
      if(str.substring(i - 5, i).equals("erase")){
        dp[i] |= dp[i - 5];
      }
      if(i - 7 >= 0 
        && str.substring(i - 7, i).equals("dreamer")){
          dp[i] |= dp[i - 7];
      }
      if(i - 6 >= 0
        && str.substring(i - 6, i).equals("eraser")){
        dp[i] |= dp[i - 6];
      }
    }

    if(dp[n]){
      System.out.println("YES");
    }
    else{
      System.out.println("NO");
    }
  }
} Main static String str; str public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    str = sc.next();
    int n = str.length();

    boolean[] dp = new boolean[n + 1];
    dp[0] = true;
    for(int i = 5; i <= n; i++){
      if(str.substring(i - 5, i).equals("dream")){
        dp[i] |= dp[i - 5];
      }
      if(str.substring(i - 5, i).equals("erase")){
        dp[i] |= dp[i - 5];
      }
      if(i - 7 >= 0 
        && str.substring(i - 7, i).equals("dreamer")){
          dp[i] |= dp[i - 7];
      }
      if(i - 6 >= 0
        && str.substring(i - 6, i).equals("eraser")){
        dp[i] |= dp[i - 6];
      }
    }

    if(dp[n]){
      System.out.println("YES");
    }
    else{
      System.out.println("NO");
    }
  } main {
    Scanner sc = new Scanner(System.in);

    str = sc.next();
    int n = str.length();

    boolean[] dp = new boolean[n + 1];
    dp[0] = true;
    for(int i = 5; i <= n; i++){
      if(str.substring(i - 5, i).equals("dream")){
        dp[i] |= dp[i - 5];
      }
      if(str.substring(i - 5, i).equals("erase")){
        dp[i] |= dp[i - 5];
      }
      if(i - 7 >= 0 
        && str.substring(i - 7, i).equals("dreamer")){
          dp[i] |= dp[i - 7];
      }
      if(i - 6 >= 0
        && str.substring(i - 6, i).equals("eraser")){
        dp[i] |= dp[i - 6];
      }
    }

    if(dp[n]){
      System.out.println("YES");
    }
    else{
      System.out.println("NO");
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) str = sc.next() str sc.next() sc.next sc int n = str.length(); n str.length() str.length str boolean[] dp = new boolean[n + 1]; dp new boolean[n + 1] n + 1 n 1 dp[0] = true dp[0] dp 0 true for(int i = 5; i <= n; i++){
      if(str.substring(i - 5, i).equals("dream")){
        dp[i] |= dp[i - 5];
      }
      if(str.substring(i - 5, i).equals("erase")){
        dp[i] |= dp[i - 5];
      }
      if(i - 7 >= 0 
        && str.substring(i - 7, i).equals("dreamer")){
          dp[i] |= dp[i - 7];
      }
      if(i - 6 >= 0
        && str.substring(i - 6, i).equals("eraser")){
        dp[i] |= dp[i - 6];
      }
    } int i = 5; int i = 5; i 5 i <= n i n i++ i++ i {
      if(str.substring(i - 5, i).equals("dream")){
        dp[i] |= dp[i - 5];
      }
      if(str.substring(i - 5, i).equals("erase")){
        dp[i] |= dp[i - 5];
      }
      if(i - 7 >= 0 
        && str.substring(i - 7, i).equals("dreamer")){
          dp[i] |= dp[i - 7];
      }
      if(i - 6 >= 0
        && str.substring(i - 6, i).equals("eraser")){
        dp[i] |= dp[i - 6];
      }
    } {
      if(str.substring(i - 5, i).equals("dream")){
        dp[i] |= dp[i - 5];
      }
      if(str.substring(i - 5, i).equals("erase")){
        dp[i] |= dp[i - 5];
      }
      if(i - 7 >= 0 
        && str.substring(i - 7, i).equals("dreamer")){
          dp[i] |= dp[i - 7];
      }
      if(i - 6 >= 0
        && str.substring(i - 6, i).equals("eraser")){
        dp[i] |= dp[i - 6];
      }
    } if(str.substring(i - 5, i).equals("dream")){
        dp[i] |= dp[i - 5];
      } str.substring(i - 5, i).equals("dream") str.substring(i - 5, i).equals str.substring(i - 5, i) str.substring str i - 5 i 5 i "dream" {
        dp[i] |= dp[i - 5];
      } dp[i] |= dp[i - 5] dp[i] dp i dp[i - 5] dp i - 5 i 5 if(str.substring(i - 5, i).equals("erase")){
        dp[i] |= dp[i - 5];
      } str.substring(i - 5, i).equals("erase") str.substring(i - 5, i).equals str.substring(i - 5, i) str.substring str i - 5 i 5 i "erase" {
        dp[i] |= dp[i - 5];
      } dp[i] |= dp[i - 5] dp[i] dp i dp[i - 5] dp i - 5 i 5 if(i - 7 >= 0 
        && str.substring(i - 7, i).equals("dreamer")){
          dp[i] |= dp[i - 7];
      } i - 7 >= 0 
        && str.substring(i - 7, i).equals("dreamer") i - 7 >= 0 i - 7 i 7 0 str.substring(i - 7, i).equals("dreamer") str.substring(i - 7, i).equals str.substring(i - 7, i) str.substring str i - 7 i 7 i "dreamer" {
          dp[i] |= dp[i - 7];
      } dp[i] |= dp[i - 7] dp[i] dp i dp[i - 7] dp i - 7 i 7 if(i - 6 >= 0
        && str.substring(i - 6, i).equals("eraser")){
        dp[i] |= dp[i - 6];
      } i - 6 >= 0
        && str.substring(i - 6, i).equals("eraser") i - 6 >= 0 i - 6 i 6 0 str.substring(i - 6, i).equals("eraser") str.substring(i - 6, i).equals str.substring(i - 6, i) str.substring str i - 6 i 6 i "eraser" {
        dp[i] |= dp[i - 6];
      } dp[i] |= dp[i - 6] dp[i] dp i dp[i - 6] dp i - 6 i 6 if(dp[n]){
      System.out.println("YES");
    }
    else{
      System.out.println("NO");
    } dp[n] dp n {
      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 {
  static String str;

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    str = sc.next();
    int n = str.length();

    boolean[] dp = new boolean[n + 1];
    dp[0] = true;
    for(int i = 5; i <= n; i++){
      if(str.substring(i - 5, i).equals("dream")){
        dp[i] |= dp[i - 5];
      }
      if(str.substring(i - 5, i).equals("erase")){
        dp[i] |= dp[i - 5];
      }
      if(i - 7 >= 0 
        && str.substring(i - 7, i).equals("dreamer")){
          dp[i] |= dp[i - 7];
      }
      if(i - 6 >= 0
        && str.substring(i - 6, i).equals("eraser")){
        dp[i] |= dp[i - 6];
      }
    }

    if(dp[n]){
      System.out.println("YES");
    }
    else{
      System.out.println("NO");
    }
  }
} public class Main {
  static String str;

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    str = sc.next();
    int n = str.length();

    boolean[] dp = new boolean[n + 1];
    dp[0] = true;
    for(int i = 5; i <= n; i++){
      if(str.substring(i - 5, i).equals("dream")){
        dp[i] |= dp[i - 5];
      }
      if(str.substring(i - 5, i).equals("erase")){
        dp[i] |= dp[i - 5];
      }
      if(i - 7 >= 0 
        && str.substring(i - 7, i).equals("dreamer")){
          dp[i] |= dp[i - 7];
      }
      if(i - 6 >= 0
        && str.substring(i - 6, i).equals("eraser")){
        dp[i] |= dp[i - 6];
      }
    }

    if(dp[n]){
      System.out.println("YES");
    }
    else{
      System.out.println("NO");
    }
  }
} Main
import java.util.Scanner;

public class Main {
  static String str;

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    str = sc.next();
    int n = str.length();

    boolean[] dp = new boolean[n + 1];
    dp[0] = true;
    for(int i = 5; i <= n; i++){
      if(str.substring(i - 5, i).equals("dream")){
        dp[i] |= dp[i - 5];
      }
      if(str.substring(i - 5, i).equals("erase")){
        dp[i] |= dp[i - 5];
      }
      if(i - 7 >= 0 
        && str.substring(i - 7, i).equals("dreamer")){
          dp[i] |= dp[i - 7];
      }
      if(i - 6 >= 0
        && str.substring(i - 6, i).equals("eraser")){
        dp[i] |= dp[i - 6];
      }
    }

    if(dp[n]){
      System.out.println("YES");
    }
    else{
      System.out.println("NO");
    }
  }
}
