import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    String[] strs = {"dream", "dreamer", "erase", "eraser"};
    if(ans(0, str,strs)){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  }
  
  public static boolean ans(int index, String str, String[] strs){
    if(str.length() == index){
      return true;
    }
    for(int i = 0; i < strs.length; i++){
      if(str.indexOf(strs[i], index) == index){
        if(ans(index + strs[i].length(), str, strs)){
          return true;
        }
      }
    }
    return false;
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    String[] strs = {"dream", "dreamer", "erase", "eraser"};
    if(ans(0, str,strs)){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  }
  
  public static boolean ans(int index, String str, String[] strs){
    if(str.length() == index){
      return true;
    }
    for(int i = 0; i < strs.length; i++){
      if(str.indexOf(strs[i], index) == index){
        if(ans(index + strs[i].length(), str, strs)){
          return true;
        }
      }
    }
    return false;
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    String[] strs = {"dream", "dreamer", "erase", "eraser"};
    if(ans(0, str,strs)){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  } main {
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    String[] strs = {"dream", "dreamer", "erase", "eraser"};
    if(ans(0, str,strs)){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.next(); str sc.next() sc.next sc String[] strs = {"dream", "dreamer", "erase", "eraser"}; strs {"dream", "dreamer", "erase", "eraser"} "dream" "dreamer" "erase" "eraser" if(ans(0, str,strs)){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    } ans(0, str,strs) ans 0 str strs {
      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 ans(int index, String str, String[] strs){
    if(str.length() == index){
      return true;
    }
    for(int i = 0; i < strs.length; i++){
      if(str.indexOf(strs[i], index) == index){
        if(ans(index + strs[i].length(), str, strs)){
          return true;
        }
      }
    }
    return false;
  } ans {
    if(str.length() == index){
      return true;
    }
    for(int i = 0; i < strs.length; i++){
      if(str.indexOf(strs[i], index) == index){
        if(ans(index + strs[i].length(), str, strs)){
          return true;
        }
      }
    }
    return false;
  } if(str.length() == index){
      return true;
    } str.length() == index str.length() str.length str index {
      return true;
    } return true; true for(int i = 0; i < strs.length; i++){
      if(str.indexOf(strs[i], index) == index){
        if(ans(index + strs[i].length(), str, strs)){
          return true;
        }
      }
    } int i = 0; int i = 0; i 0 i < strs.length i strs.length strs strs.length i++ i++ i {
      if(str.indexOf(strs[i], index) == index){
        if(ans(index + strs[i].length(), str, strs)){
          return true;
        }
      }
    } {
      if(str.indexOf(strs[i], index) == index){
        if(ans(index + strs[i].length(), str, strs)){
          return true;
        }
      }
    } if(str.indexOf(strs[i], index) == index){
        if(ans(index + strs[i].length(), str, strs)){
          return true;
        }
      } str.indexOf(strs[i], index) == index str.indexOf(strs[i], index) str.indexOf str strs[i] strs i index index {
        if(ans(index + strs[i].length(), str, strs)){
          return true;
        }
      } if(ans(index + strs[i].length(), str, strs)){
          return true;
        } ans(index + strs[i].length(), str, strs) ans index + strs[i].length() index strs[i].length() strs[i].length strs[i] strs i str strs {
          return true;
        } return true; true return false; false int index index String str str String[] strs strs public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    String[] strs = {"dream", "dreamer", "erase", "eraser"};
    if(ans(0, str,strs)){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  }
  
  public static boolean ans(int index, String str, String[] strs){
    if(str.length() == index){
      return true;
    }
    for(int i = 0; i < strs.length; i++){
      if(str.indexOf(strs[i], index) == index){
        if(ans(index + strs[i].length(), str, strs)){
          return true;
        }
      }
    }
    return false;
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    String[] strs = {"dream", "dreamer", "erase", "eraser"};
    if(ans(0, str,strs)){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  }
  
  public static boolean ans(int index, String str, String[] strs){
    if(str.length() == index){
      return true;
    }
    for(int i = 0; i < strs.length; i++){
      if(str.indexOf(strs[i], index) == index){
        if(ans(index + strs[i].length(), str, strs)){
          return true;
        }
      }
    }
    return false;
  }
} Main
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    String[] strs = {"dream", "dreamer", "erase", "eraser"};
    if(ans(0, str,strs)){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  }
  
  public static boolean ans(int index, String str, String[] strs){
    if(str.length() == index){
      return true;
    }
    for(int i = 0; i < strs.length; i++){
      if(str.indexOf(strs[i], index) == index){
        if(ans(index + strs[i].length(), str, strs)){
          return true;
        }
      }
    }
    return false;
  }
}