import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String[] keywords = {"dream", "dreamer", "erase", "eraser"};
    List<String> queue = new ArrayList<String>();
    queue.add(s);
    while (queue.size() > 0) {
      s = queue.remove(queue.size() - 1);
      if (s.isEmpty()) {
        System.out.println("YES");
        return;
      }
      for (int i = 0; i < 4; i++) {
        String keyword = keywords[i];
        String ts = s.replaceAll(keyword, "");
        if (s.length() > ts.length()) queue.add(ts);
      }
    }
    System.out.println("NO");
  }
} import java.util.Scanner; Scanner java.util import java.util.List; List java.util import java.util.ArrayList; ArrayList java.util public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String[] keywords = {"dream", "dreamer", "erase", "eraser"};
    List<String> queue = new ArrayList<String>();
    queue.add(s);
    while (queue.size() > 0) {
      s = queue.remove(queue.size() - 1);
      if (s.isEmpty()) {
        System.out.println("YES");
        return;
      }
      for (int i = 0; i < 4; i++) {
        String keyword = keywords[i];
        String ts = s.replaceAll(keyword, "");
        if (s.length() > ts.length()) queue.add(ts);
      }
    }
    System.out.println("NO");
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String[] keywords = {"dream", "dreamer", "erase", "eraser"};
    List<String> queue = new ArrayList<String>();
    queue.add(s);
    while (queue.size() > 0) {
      s = queue.remove(queue.size() - 1);
      if (s.isEmpty()) {
        System.out.println("YES");
        return;
      }
      for (int i = 0; i < 4; i++) {
        String keyword = keywords[i];
        String ts = s.replaceAll(keyword, "");
        if (s.length() > ts.length()) queue.add(ts);
      }
    }
    System.out.println("NO");
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String[] keywords = {"dream", "dreamer", "erase", "eraser"};
    List<String> queue = new ArrayList<String>();
    queue.add(s);
    while (queue.size() > 0) {
      s = queue.remove(queue.size() - 1);
      if (s.isEmpty()) {
        System.out.println("YES");
        return;
      }
      for (int i = 0; i < 4; i++) {
        String keyword = keywords[i];
        String ts = s.replaceAll(keyword, "");
        if (s.length() > ts.length()) queue.add(ts);
      }
    }
    System.out.println("NO");
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String[] keywords = {"dream", "dreamer", "erase", "eraser"}; keywords {"dream", "dreamer", "erase", "eraser"} "dream" "dreamer" "erase" "eraser" List<String> queue = new ArrayList<String>(); queue new ArrayList<String>() queue.add(s) queue.add queue s while (queue.size() > 0) {
      s = queue.remove(queue.size() - 1);
      if (s.isEmpty()) {
        System.out.println("YES");
        return;
      }
      for (int i = 0; i < 4; i++) {
        String keyword = keywords[i];
        String ts = s.replaceAll(keyword, "");
        if (s.length() > ts.length()) queue.add(ts);
      }
    } queue.size() > 0 queue.size() queue.size queue 0 {
      s = queue.remove(queue.size() - 1);
      if (s.isEmpty()) {
        System.out.println("YES");
        return;
      }
      for (int i = 0; i < 4; i++) {
        String keyword = keywords[i];
        String ts = s.replaceAll(keyword, "");
        if (s.length() > ts.length()) queue.add(ts);
      }
    } s = queue.remove(queue.size() - 1) s queue.remove(queue.size() - 1) queue.remove queue queue.size() - 1 queue.size() queue.size queue 1 if (s.isEmpty()) {
        System.out.println("YES");
        return;
      } s.isEmpty() s.isEmpty s {
        System.out.println("YES");
        return;
      } System.out.println("YES") System.out.println System.out System System.out "YES" return; for (int i = 0; i < 4; i++) {
        String keyword = keywords[i];
        String ts = s.replaceAll(keyword, "");
        if (s.length() > ts.length()) queue.add(ts);
      } int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
        String keyword = keywords[i];
        String ts = s.replaceAll(keyword, "");
        if (s.length() > ts.length()) queue.add(ts);
      } {
        String keyword = keywords[i];
        String ts = s.replaceAll(keyword, "");
        if (s.length() > ts.length()) queue.add(ts);
      } String keyword = keywords[i]; keyword keywords[i] keywords i String ts = s.replaceAll(keyword, ""); ts s.replaceAll(keyword, "") s.replaceAll s keyword "" if (s.length() > ts.length()) queue.add(ts); s.length() > ts.length() s.length() s.length s ts.length() ts.length ts queue.add(ts) queue.add queue ts System.out.println("NO") System.out.println System.out System System.out "NO" String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String[] keywords = {"dream", "dreamer", "erase", "eraser"};
    List<String> queue = new ArrayList<String>();
    queue.add(s);
    while (queue.size() > 0) {
      s = queue.remove(queue.size() - 1);
      if (s.isEmpty()) {
        System.out.println("YES");
        return;
      }
      for (int i = 0; i < 4; i++) {
        String keyword = keywords[i];
        String ts = s.replaceAll(keyword, "");
        if (s.length() > ts.length()) queue.add(ts);
      }
    }
    System.out.println("NO");
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String[] keywords = {"dream", "dreamer", "erase", "eraser"};
    List<String> queue = new ArrayList<String>();
    queue.add(s);
    while (queue.size() > 0) {
      s = queue.remove(queue.size() - 1);
      if (s.isEmpty()) {
        System.out.println("YES");
        return;
      }
      for (int i = 0; i < 4; i++) {
        String keyword = keywords[i];
        String ts = s.replaceAll(keyword, "");
        if (s.length() > ts.length()) queue.add(ts);
      }
    }
    System.out.println("NO");
  }
} Main
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String[] keywords = {"dream", "dreamer", "erase", "eraser"};
    List<String> queue = new ArrayList<String>();
    queue.add(s);
    while (queue.size() > 0) {
      s = queue.remove(queue.size() - 1);
      if (s.isEmpty()) {
        System.out.println("YES");
        return;
      }
      for (int i = 0; i < 4; i++) {
        String keyword = keywords[i];
        String ts = s.replaceAll(keyword, "");
        if (s.length() > ts.length()) queue.add(ts);
      }
    }
    System.out.println("NO");
  }
}