import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int n = s.length();
    Map<Integer,Boolean> memo = new HashMap<>();
    String[] words = new String[]{"dream","dreamer","erase","eraser"};
    if (dp(0,s,memo,words) == true){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }

  }
  public static boolean dp(int i, String s, Map<Integer,Boolean> memo, String[] words){
    if (i == s.length()){return true;}
    if (!memo.containsKey(i)){
      boolean ans = false;
      for (String word: words){
        if (s.substring(i).startsWith(word) == true){
          ans = ans || dp(i + word.length(),s,memo,words);
        }
      }
      memo.put(i,ans);
    }
    return memo.get(i);
  }
} import java.util.*; util.* java class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int n = s.length();
    Map<Integer,Boolean> memo = new HashMap<>();
    String[] words = new String[]{"dream","dreamer","erase","eraser"};
    if (dp(0,s,memo,words) == true){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }

  }
  public static boolean dp(int i, String s, Map<Integer,Boolean> memo, String[] words){
    if (i == s.length()){return true;}
    if (!memo.containsKey(i)){
      boolean ans = false;
      for (String word: words){
        if (s.substring(i).startsWith(word) == true){
          ans = ans || dp(i + word.length(),s,memo,words);
        }
      }
      memo.put(i,ans);
    }
    return memo.get(i);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int n = s.length();
    Map<Integer,Boolean> memo = new HashMap<>();
    String[] words = new String[]{"dream","dreamer","erase","eraser"};
    if (dp(0,s,memo,words) == true){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }

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

  }
  public static boolean dp(int i, String s, Map<Integer,Boolean> memo, String[] words){
    if (i == s.length()){return true;}
    if (!memo.containsKey(i)){
      boolean ans = false;
      for (String word: words){
        if (s.substring(i).startsWith(word) == true){
          ans = ans || dp(i + word.length(),s,memo,words);
        }
      }
      memo.put(i,ans);
    }
    return memo.get(i);
  }
}