import java.util.*;

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

    String S = "1" + sc.next();

    S = S.replaceAll("eraser", "");
    S = S.replaceAll("erase", "");
    S = S.replaceAll("dreamer", "");
    S = S.replaceAll("dream", "");
    
    System.out.println(S.equals("1") ? "YES": "NO");
  }
} import java.util.*; util.* java public class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);

    String S = "1" + sc.next();

    S = S.replaceAll("eraser", "");
    S = S.replaceAll("erase", "");
    S = S.replaceAll("dreamer", "");
    S = S.replaceAll("dream", "");
    
    System.out.println(S.equals("1") ? "YES": "NO");
  }
} Main public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);

    String S = "1" + sc.next();

    S = S.replaceAll("eraser", "");
    S = S.replaceAll("erase", "");
    S = S.replaceAll("dreamer", "");
    S = S.replaceAll("dream", "");
    
    System.out.println(S.equals("1") ? "YES": "NO");
  } main {
    Scanner sc = new Scanner(System.in);

    String S = "1" + sc.next();

    S = S.replaceAll("eraser", "");
    S = S.replaceAll("erase", "");
    S = S.replaceAll("dreamer", "");
    S = S.replaceAll("dream", "");
    
    System.out.println(S.equals("1") ? "YES": "NO");
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = "1" + sc.next(); S "1" + sc.next() "1" sc.next() sc.next sc S = S.replaceAll("eraser", "") S S.replaceAll("eraser", "") S.replaceAll S "eraser" "" S = S.replaceAll("erase", "") S S.replaceAll("erase", "") S.replaceAll S "erase" "" S = S.replaceAll("dreamer", "") S S.replaceAll("dreamer", "") S.replaceAll S "dreamer" "" S = S.replaceAll("dream", "") S S.replaceAll("dream", "") S.replaceAll S "dream" "" System.out.println(S.equals("1") ? "YES": "NO") System.out.println System.out System System.out S.equals("1") ? "YES": "NO" S.equals("1") S.equals S "1" "YES" "NO" String[] args args public class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);

    String S = "1" + sc.next();

    S = S.replaceAll("eraser", "");
    S = S.replaceAll("erase", "");
    S = S.replaceAll("dreamer", "");
    S = S.replaceAll("dream", "");
    
    System.out.println(S.equals("1") ? "YES": "NO");
  }
} public class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);

    String S = "1" + sc.next();

    S = S.replaceAll("eraser", "");
    S = S.replaceAll("erase", "");
    S = S.replaceAll("dreamer", "");
    S = S.replaceAll("dream", "");
    
    System.out.println(S.equals("1") ? "YES": "NO");
  }
} Main
import java.util.*;

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

    String S = "1" + sc.next();

    S = S.replaceAll("eraser", "");
    S = S.replaceAll("erase", "");
    S = S.replaceAll("dreamer", "");
    S = S.replaceAll("dream", "");
    
    System.out.println(S.equals("1") ? "YES": "NO");
  }
}
