import java.util.*;

public class Main {
  public static void main(String[] args) {
    StringBuffer[] devide = {new StringBuffer("dream"), new StringBuffer("dreamer"), new StringBuffer("erase"), new StringBuffer("eraser")};
    Scanner sc = new Scanner(System.in);
    StringBuffer S = new StringBuffer(sc.next());
    S.reverse(); // 入力された文字列を反転
    for (int i = 0; i < devide.length; i++) {
      devide[i].reverse(); // devideのそれぞれの文字列を反転
    }
    boolean can = true;
    for (int i = 0; i < S.length(); ) {
      boolean can2 = false;
      for (int j = 0; j < devide.length; j++) {
        String d = new String(devide[j]);
        if (i + d.length() <= S.length() && S.substring(i, i + d.length()).equals(d)) {
          can2 = true;
          i += d.length();
        }
      }
      if (!can2) {
        can = false;
        break;
      }
    }
    if (can) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    StringBuffer[] devide = {new StringBuffer("dream"), new StringBuffer("dreamer"), new StringBuffer("erase"), new StringBuffer("eraser")};
    Scanner sc = new Scanner(System.in);
    StringBuffer S = new StringBuffer(sc.next());
    S.reverse(); // 入力された文字列を反転
    for (int i = 0; i < devide.length; i++) {
      devide[i].reverse(); // devideのそれぞれの文字列を反転
    }
    boolean can = true;
    for (int i = 0; i < S.length(); ) {
      boolean can2 = false;
      for (int j = 0; j < devide.length; j++) {
        String d = new String(devide[j]);
        if (i + d.length() <= S.length() && S.substring(i, i + d.length()).equals(d)) {
          can2 = true;
          i += d.length();
        }
      }
      if (!can2) {
        can = false;
        break;
      }
    }
    if (can) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }
} Main public static void main(String[] args) {
    StringBuffer[] devide = {new StringBuffer("dream"), new StringBuffer("dreamer"), new StringBuffer("erase"), new StringBuffer("eraser")};
    Scanner sc = new Scanner(System.in);
    StringBuffer S = new StringBuffer(sc.next());
    S.reverse(); // 入力された文字列を反転
    for (int i = 0; i < devide.length; i++) {
      devide[i].reverse(); // devideのそれぞれの文字列を反転
    }
    boolean can = true;
    for (int i = 0; i < S.length(); ) {
      boolean can2 = false;
      for (int j = 0; j < devide.length; j++) {
        String d = new String(devide[j]);
        if (i + d.length() <= S.length() && S.substring(i, i + d.length()).equals(d)) {
          can2 = true;
          i += d.length();
        }
      }
      if (!can2) {
        can = false;
        break;
      }
    }
    if (can) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  } main {
    StringBuffer[] devide = {new StringBuffer("dream"), new StringBuffer("dreamer"), new StringBuffer("erase"), new StringBuffer("eraser")};
    Scanner sc = new Scanner(System.in);
    StringBuffer S = new StringBuffer(sc.next());
    S.reverse(); // 入力された文字列を反転
    for (int i = 0; i < devide.length; i++) {
      devide[i].reverse(); // devideのそれぞれの文字列を反転
    }
    boolean can = true;
    for (int i = 0; i < S.length(); ) {
      boolean can2 = false;
      for (int j = 0; j < devide.length; j++) {
        String d = new String(devide[j]);
        if (i + d.length() <= S.length() && S.substring(i, i + d.length()).equals(d)) {
          can2 = true;
          i += d.length();
        }
      }
      if (!can2) {
        can = false;
        break;
      }
    }
    if (can) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  } StringBuffer[] devide = {new StringBuffer("dream"), new StringBuffer("dreamer"), new StringBuffer("erase"), new StringBuffer("eraser")}; devide {new StringBuffer("dream"), new StringBuffer("dreamer"), new StringBuffer("erase"), new StringBuffer("eraser")} new StringBuffer("dream") new StringBuffer("dreamer") new StringBuffer("erase") new StringBuffer("eraser") Scanner sc = new Scanner(System.in); sc new Scanner(System.in) StringBuffer S = new StringBuffer(sc.next()); S new StringBuffer(sc.next()) S.reverse() S.reverse S for (int i = 0; i < devide.length; i++) {
      devide[i].reverse(); // devideのそれぞれの文字列を反転
    } int i = 0; int i = 0; i 0 i < devide.length i devide.length devide devide.length i++ i++ i {
      devide[i].reverse(); // devideのそれぞれの文字列を反転
    } {
      devide[i].reverse(); // devideのそれぞれの文字列を反転
    } devide[i].reverse() devide[i].reverse devide[i] devide i boolean can = true; can true for (int i = 0; i < S.length(); ) {
      boolean can2 = false;
      for (int j = 0; j < devide.length; j++) {
        String d = new String(devide[j]);
        if (i + d.length() <= S.length() && S.substring(i, i + d.length()).equals(d)) {
          can2 = true;
          i += d.length();
        }
      }
      if (!can2) {
        can = false;
        break;
      }
    } int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S {
      boolean can2 = false;
      for (int j = 0; j < devide.length; j++) {
        String d = new String(devide[j]);
        if (i + d.length() <= S.length() && S.substring(i, i + d.length()).equals(d)) {
          can2 = true;
          i += d.length();
        }
      }
      if (!can2) {
        can = false;
        break;
      }
    } {
      boolean can2 = false;
      for (int j = 0; j < devide.length; j++) {
        String d = new String(devide[j]);
        if (i + d.length() <= S.length() && S.substring(i, i + d.length()).equals(d)) {
          can2 = true;
          i += d.length();
        }
      }
      if (!can2) {
        can = false;
        break;
      }
    } boolean can2 = false; can2 false for (int j = 0; j < devide.length; j++) {
        String d = new String(devide[j]);
        if (i + d.length() <= S.length() && S.substring(i, i + d.length()).equals(d)) {
          can2 = true;
          i += d.length();
        }
      } int j = 0; int j = 0; j 0 j < devide.length j devide.length devide devide.length j++ j++ j {
        String d = new String(devide[j]);
        if (i + d.length() <= S.length() && S.substring(i, i + d.length()).equals(d)) {
          can2 = true;
          i += d.length();
        }
      } {
        String d = new String(devide[j]);
        if (i + d.length() <= S.length() && S.substring(i, i + d.length()).equals(d)) {
          can2 = true;
          i += d.length();
        }
      } String d = new String(devide[j]); d new String(devide[j]) if (i + d.length() <= S.length() && S.substring(i, i + d.length()).equals(d)) {
          can2 = true;
          i += d.length();
        } i + d.length() <= S.length() && S.substring(i, i + d.length()).equals(d) i + d.length() <= S.length() i + d.length() i d.length() d.length d S.length() S.length S S.substring(i, i + d.length()).equals(d) S.substring(i, i + d.length()).equals S.substring(i, i + d.length()) S.substring S i i + d.length() i d.length() d.length d d {
          can2 = true;
          i += d.length();
        } can2 = true can2 true i += d.length() i d.length() d.length d if (!can2) {
        can = false;
        break;
      } !can2 can2 {
        can = false;
        break;
      } can = false can false break; if (can) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    } can {
      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 class Main {
  public static void main(String[] args) {
    StringBuffer[] devide = {new StringBuffer("dream"), new StringBuffer("dreamer"), new StringBuffer("erase"), new StringBuffer("eraser")};
    Scanner sc = new Scanner(System.in);
    StringBuffer S = new StringBuffer(sc.next());
    S.reverse(); // 入力された文字列を反転
    for (int i = 0; i < devide.length; i++) {
      devide[i].reverse(); // devideのそれぞれの文字列を反転
    }
    boolean can = true;
    for (int i = 0; i < S.length(); ) {
      boolean can2 = false;
      for (int j = 0; j < devide.length; j++) {
        String d = new String(devide[j]);
        if (i + d.length() <= S.length() && S.substring(i, i + d.length()).equals(d)) {
          can2 = true;
          i += d.length();
        }
      }
      if (!can2) {
        can = false;
        break;
      }
    }
    if (can) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }
} public class Main {
  public static void main(String[] args) {
    StringBuffer[] devide = {new StringBuffer("dream"), new StringBuffer("dreamer"), new StringBuffer("erase"), new StringBuffer("eraser")};
    Scanner sc = new Scanner(System.in);
    StringBuffer S = new StringBuffer(sc.next());
    S.reverse(); // 入力された文字列を反転
    for (int i = 0; i < devide.length; i++) {
      devide[i].reverse(); // devideのそれぞれの文字列を反転
    }
    boolean can = true;
    for (int i = 0; i < S.length(); ) {
      boolean can2 = false;
      for (int j = 0; j < devide.length; j++) {
        String d = new String(devide[j]);
        if (i + d.length() <= S.length() && S.substring(i, i + d.length()).equals(d)) {
          can2 = true;
          i += d.length();
        }
      }
      if (!can2) {
        can = false;
        break;
      }
    }
    if (can) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    StringBuffer[] devide = {new StringBuffer("dream"), new StringBuffer("dreamer"), new StringBuffer("erase"), new StringBuffer("eraser")};
    Scanner sc = new Scanner(System.in);
    StringBuffer S = new StringBuffer(sc.next());
    S.reverse(); // 入力された文字列を反転
    for (int i = 0; i < devide.length; i++) {
      devide[i].reverse(); // devideのそれぞれの文字列を反転
    }
    boolean can = true;
    for (int i = 0; i < S.length(); ) {
      boolean can2 = false;
      for (int j = 0; j < devide.length; j++) {
        String d = new String(devide[j]);
        if (i + d.length() <= S.length() && S.substring(i, i + d.length()).equals(d)) {
          can2 = true;
          i += d.length();
        }
      }
      if (!can2) {
        can = false;
        break;
      }
    }
    if (can) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }
}