import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String[] words = new String[]{"dream","dreamer","erase","eraser"};
    int n = s.length();
    boolean[] dp = new boolean[n+1];
    dp[n] = true;
    for (int i = n-1; i >= 0; i--){
      for (String word: words){
        if (s.substring(i).startsWith(word)){
          dp[i] = dp[i] || dp[i+word.length()];
        }
      }
    }
    if (dp[0] == true){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  }
} import java.util.*; util.* java class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String[] words = new String[]{"dream","dreamer","erase","eraser"};
    int n = s.length();
    boolean[] dp = new boolean[n+1];
    dp[n] = true;
    for (int i = n-1; i >= 0; i--){
      for (String word: words){
        if (s.substring(i).startsWith(word)){
          dp[i] = dp[i] || dp[i+word.length()];
        }
      }
    }
    if (dp[0] == true){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String[] words = new String[]{"dream","dreamer","erase","eraser"};
    int n = s.length();
    boolean[] dp = new boolean[n+1];
    dp[n] = true;
    for (int i = n-1; i >= 0; i--){
      for (String word: words){
        if (s.substring(i).startsWith(word)){
          dp[i] = dp[i] || dp[i+word.length()];
        }
      }
    }
    if (dp[0] == true){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String[] words = new String[]{"dream","dreamer","erase","eraser"};
    int n = s.length();
    boolean[] dp = new boolean[n+1];
    dp[n] = true;
    for (int i = n-1; i >= 0; i--){
      for (String word: words){
        if (s.substring(i).startsWith(word)){
          dp[i] = dp[i] || dp[i+word.length()];
        }
      }
    }
    if (dp[0] == true){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String[] words = new String[]{"dream","dreamer","erase","eraser"}; words new String[]{"dream","dreamer","erase","eraser"} int n = s.length(); n s.length() s.length s boolean[] dp = new boolean[n+1]; dp new boolean[n+1] n+1 n 1 dp[n] = true dp[n] dp n true for (int i = n-1; i >= 0; i--){
      for (String word: words){
        if (s.substring(i).startsWith(word)){
          dp[i] = dp[i] || dp[i+word.length()];
        }
      }
    } int i = n-1; int i = n-1; i n-1 n 1 i >= 0 i 0 i-- i-- i {
      for (String word: words){
        if (s.substring(i).startsWith(word)){
          dp[i] = dp[i] || dp[i+word.length()];
        }
      }
    } {
      for (String word: words){
        if (s.substring(i).startsWith(word)){
          dp[i] = dp[i] || dp[i+word.length()];
        }
      }
    } for (String word: words){
        if (s.substring(i).startsWith(word)){
          dp[i] = dp[i] || dp[i+word.length()];
        }
      } String word words {
        if (s.substring(i).startsWith(word)){
          dp[i] = dp[i] || dp[i+word.length()];
        }
      } {
        if (s.substring(i).startsWith(word)){
          dp[i] = dp[i] || dp[i+word.length()];
        }
      } if (s.substring(i).startsWith(word)){
          dp[i] = dp[i] || dp[i+word.length()];
        } s.substring(i).startsWith(word) s.substring(i).startsWith s.substring(i) s.substring s i word {
          dp[i] = dp[i] || dp[i+word.length()];
        } dp[i] = dp[i] || dp[i+word.length()] dp[i] dp i dp[i] || dp[i+word.length()] dp[i] dp i dp[i+word.length()] dp i+word.length() i word.length() word.length word if (dp[0] == true){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    } dp[0] == true dp[0] dp 0 true {
      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
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String[] words = new String[]{"dream","dreamer","erase","eraser"};
    int n = s.length();
    boolean[] dp = new boolean[n+1];
    dp[n] = true;
    for (int i = n-1; i >= 0; i--){
      for (String word: words){
        if (s.substring(i).startsWith(word)){
          dp[i] = dp[i] || dp[i+word.length()];
        }
      }
    }
    if (dp[0] == true){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  }
}