import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int i = S.length();
    while (i > 0) {
      if (i-7 >= 0 && S.substring(i-7, i).equals("dreamer")) {
        i -= 7;
      } else if (i-6 >= 0 && S.substring(i-6, i).equals("eraser")) {
        i -= 6;
      } else if (i-5 >= 0
                 && (S.substring(i-5, i).equals("erase")
                     || S.substring(i-5, i).equals("dream"))) {
        i -= 5;
      } else {
        break;
      }
    }
    System.out.println(i == 0 ? "YES" : "NO");
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int i = S.length();
    while (i > 0) {
      if (i-7 >= 0 && S.substring(i-7, i).equals("dreamer")) {
        i -= 7;
      } else if (i-6 >= 0 && S.substring(i-6, i).equals("eraser")) {
        i -= 6;
      } else if (i-5 >= 0
                 && (S.substring(i-5, i).equals("erase")
                     || S.substring(i-5, i).equals("dream"))) {
        i -= 5;
      } else {
        break;
      }
    }
    System.out.println(i == 0 ? "YES" : "NO");
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int i = S.length();
    while (i > 0) {
      if (i-7 >= 0 && S.substring(i-7, i).equals("dreamer")) {
        i -= 7;
      } else if (i-6 >= 0 && S.substring(i-6, i).equals("eraser")) {
        i -= 6;
      } else if (i-5 >= 0
                 && (S.substring(i-5, i).equals("erase")
                     || S.substring(i-5, i).equals("dream"))) {
        i -= 5;
      } else {
        break;
      }
    }
    System.out.println(i == 0 ? "YES" : "NO");
  } main {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int i = S.length();
    while (i > 0) {
      if (i-7 >= 0 && S.substring(i-7, i).equals("dreamer")) {
        i -= 7;
      } else if (i-6 >= 0 && S.substring(i-6, i).equals("eraser")) {
        i -= 6;
      } else if (i-5 >= 0
                 && (S.substring(i-5, i).equals("erase")
                     || S.substring(i-5, i).equals("dream"))) {
        i -= 5;
      } else {
        break;
      }
    }
    System.out.println(i == 0 ? "YES" : "NO");
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc int i = S.length(); i S.length() S.length S while (i > 0) {
      if (i-7 >= 0 && S.substring(i-7, i).equals("dreamer")) {
        i -= 7;
      } else if (i-6 >= 0 && S.substring(i-6, i).equals("eraser")) {
        i -= 6;
      } else if (i-5 >= 0
                 && (S.substring(i-5, i).equals("erase")
                     || S.substring(i-5, i).equals("dream"))) {
        i -= 5;
      } else {
        break;
      }
    } i > 0 i 0 {
      if (i-7 >= 0 && S.substring(i-7, i).equals("dreamer")) {
        i -= 7;
      } else if (i-6 >= 0 && S.substring(i-6, i).equals("eraser")) {
        i -= 6;
      } else if (i-5 >= 0
                 && (S.substring(i-5, i).equals("erase")
                     || S.substring(i-5, i).equals("dream"))) {
        i -= 5;
      } else {
        break;
      }
    } if (i-7 >= 0 && S.substring(i-7, i).equals("dreamer")) {
        i -= 7;
      } else if (i-6 >= 0 && S.substring(i-6, i).equals("eraser")) {
        i -= 6;
      } else if (i-5 >= 0
                 && (S.substring(i-5, i).equals("erase")
                     || S.substring(i-5, i).equals("dream"))) {
        i -= 5;
      } else {
        break;
      } i-7 >= 0 && S.substring(i-7, i).equals("dreamer") i-7 >= 0 i-7 i 7 0 S.substring(i-7, i).equals("dreamer") S.substring(i-7, i).equals S.substring(i-7, i) S.substring S i-7 i 7 i "dreamer" {
        i -= 7;
      } i -= 7 i 7 if (i-6 >= 0 && S.substring(i-6, i).equals("eraser")) {
        i -= 6;
      } else if (i-5 >= 0
                 && (S.substring(i-5, i).equals("erase")
                     || S.substring(i-5, i).equals("dream"))) {
        i -= 5;
      } else {
        break;
      } i-6 >= 0 && S.substring(i-6, i).equals("eraser") i-6 >= 0 i-6 i 6 0 S.substring(i-6, i).equals("eraser") S.substring(i-6, i).equals S.substring(i-6, i) S.substring S i-6 i 6 i "eraser" {
        i -= 6;
      } i -= 6 i 6 if (i-5 >= 0
                 && (S.substring(i-5, i).equals("erase")
                     || S.substring(i-5, i).equals("dream"))) {
        i -= 5;
      } else {
        break;
      } i-5 >= 0
                 && (S.substring(i-5, i).equals("erase")
                     || S.substring(i-5, i).equals("dream")) i-5 >= 0 i-5 i 5 0 (S.substring(i-5, i).equals("erase")
                     || S.substring(i-5, i).equals("dream")) S.substring(i-5, i).equals("erase") S.substring(i-5, i).equals S.substring(i-5, i) S.substring S i-5 i 5 i "erase" S.substring(i-5, i).equals("dream") S.substring(i-5, i).equals S.substring(i-5, i) S.substring S i-5 i 5 i "dream" {
        i -= 5;
      } i -= 5 i 5 {
        break;
      } break; System.out.println(i == 0 ? "YES" : "NO") System.out.println System.out System System.out i == 0 ? "YES" : "NO" i == 0 i 0 "YES" "NO" String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int i = S.length();
    while (i > 0) {
      if (i-7 >= 0 && S.substring(i-7, i).equals("dreamer")) {
        i -= 7;
      } else if (i-6 >= 0 && S.substring(i-6, i).equals("eraser")) {
        i -= 6;
      } else if (i-5 >= 0
                 && (S.substring(i-5, i).equals("erase")
                     || S.substring(i-5, i).equals("dream"))) {
        i -= 5;
      } else {
        break;
      }
    }
    System.out.println(i == 0 ? "YES" : "NO");
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int i = S.length();
    while (i > 0) {
      if (i-7 >= 0 && S.substring(i-7, i).equals("dreamer")) {
        i -= 7;
      } else if (i-6 >= 0 && S.substring(i-6, i).equals("eraser")) {
        i -= 6;
      } else if (i-5 >= 0
                 && (S.substring(i-5, i).equals("erase")
                     || S.substring(i-5, i).equals("dream"))) {
        i -= 5;
      } else {
        break;
      }
    }
    System.out.println(i == 0 ? "YES" : "NO");
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int i = S.length();
    while (i > 0) {
      if (i-7 >= 0 && S.substring(i-7, i).equals("dreamer")) {
        i -= 7;
      } else if (i-6 >= 0 && S.substring(i-6, i).equals("eraser")) {
        i -= 6;
      } else if (i-5 >= 0
                 && (S.substring(i-5, i).equals("erase")
                     || S.substring(i-5, i).equals("dream"))) {
        i -= 5;
      } else {
        break;
      }
    }
    System.out.println(i == 0 ? "YES" : "NO");
  }
}