import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int slen = s.length();
    String t = "";
    int i = 0;
    while(i < slen){
      //いろいろ判断。適合すれば、文字数分iをずらす
      if(s.substring(slen-5-i,slen-i).equals("dream") || s.substring(slen-5-i,slen-i).equals("erase")){
        i += 5;
        continue;
      }else if(s.substring(slen-6-i,slen-i).equals("eraser")){
        i += 6;
        continue;
      }else if(s.substring(slen-7-i,slen-i).equals("dreamer")){
        i += 7;
        continue;
      }else{//どの条件にも適合しないので、等しくならない
        System.out.println("NO");
        return;
      }
    }
    System.out.println("YES");
  }
} 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 slen = s.length();
    String t = "";
    int i = 0;
    while(i < slen){
      //いろいろ判断。適合すれば、文字数分iをずらす
      if(s.substring(slen-5-i,slen-i).equals("dream") || s.substring(slen-5-i,slen-i).equals("erase")){
        i += 5;
        continue;
      }else if(s.substring(slen-6-i,slen-i).equals("eraser")){
        i += 6;
        continue;
      }else if(s.substring(slen-7-i,slen-i).equals("dreamer")){
        i += 7;
        continue;
      }else{//どの条件にも適合しないので、等しくならない
        System.out.println("NO");
        return;
      }
    }
    System.out.println("YES");
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int slen = s.length();
    String t = "";
    int i = 0;
    while(i < slen){
      //いろいろ判断。適合すれば、文字数分iをずらす
      if(s.substring(slen-5-i,slen-i).equals("dream") || s.substring(slen-5-i,slen-i).equals("erase")){
        i += 5;
        continue;
      }else if(s.substring(slen-6-i,slen-i).equals("eraser")){
        i += 6;
        continue;
      }else if(s.substring(slen-7-i,slen-i).equals("dreamer")){
        i += 7;
        continue;
      }else{//どの条件にも適合しないので、等しくならない
        System.out.println("NO");
        return;
      }
    }
    System.out.println("YES");
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int slen = s.length();
    String t = "";
    int i = 0;
    while(i < slen){
      //いろいろ判断。適合すれば、文字数分iをずらす
      if(s.substring(slen-5-i,slen-i).equals("dream") || s.substring(slen-5-i,slen-i).equals("erase")){
        i += 5;
        continue;
      }else if(s.substring(slen-6-i,slen-i).equals("eraser")){
        i += 6;
        continue;
      }else if(s.substring(slen-7-i,slen-i).equals("dreamer")){
        i += 7;
        continue;
      }else{//どの条件にも適合しないので、等しくならない
        System.out.println("NO");
        return;
      }
    }
    System.out.println("YES");
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int slen = s.length(); slen s.length() s.length s String t = ""; t "" int i = 0; i 0 while(i < slen){
      //いろいろ判断。適合すれば、文字数分iをずらす
      if(s.substring(slen-5-i,slen-i).equals("dream") || s.substring(slen-5-i,slen-i).equals("erase")){
        i += 5;
        continue;
      }else if(s.substring(slen-6-i,slen-i).equals("eraser")){
        i += 6;
        continue;
      }else if(s.substring(slen-7-i,slen-i).equals("dreamer")){
        i += 7;
        continue;
      }else{//どの条件にも適合しないので、等しくならない
        System.out.println("NO");
        return;
      }
    } i < slen i slen {
      //いろいろ判断。適合すれば、文字数分iをずらす
      if(s.substring(slen-5-i,slen-i).equals("dream") || s.substring(slen-5-i,slen-i).equals("erase")){
        i += 5;
        continue;
      }else if(s.substring(slen-6-i,slen-i).equals("eraser")){
        i += 6;
        continue;
      }else if(s.substring(slen-7-i,slen-i).equals("dreamer")){
        i += 7;
        continue;
      }else{//どの条件にも適合しないので、等しくならない
        System.out.println("NO");
        return;
      }
    } if(s.substring(slen-5-i,slen-i).equals("dream") || s.substring(slen-5-i,slen-i).equals("erase")){
        i += 5;
        continue;
      }else if(s.substring(slen-6-i,slen-i).equals("eraser")){
        i += 6;
        continue;
      }else if(s.substring(slen-7-i,slen-i).equals("dreamer")){
        i += 7;
        continue;
      }else{//どの条件にも適合しないので、等しくならない
        System.out.println("NO");
        return;
      } s.substring(slen-5-i,slen-i).equals("dream") || s.substring(slen-5-i,slen-i).equals("erase") s.substring(slen-5-i,slen-i).equals("dream") s.substring(slen-5-i,slen-i).equals s.substring(slen-5-i,slen-i) s.substring s slen-5-i slen-5-i slen 5 i slen-i slen i "dream" s.substring(slen-5-i,slen-i).equals("erase") s.substring(slen-5-i,slen-i).equals s.substring(slen-5-i,slen-i) s.substring s slen-5-i slen-5-i slen 5 i slen-i slen i "erase" {
        i += 5;
        continue;
      } i += 5 i 5 continue; if(s.substring(slen-6-i,slen-i).equals("eraser")){
        i += 6;
        continue;
      }else if(s.substring(slen-7-i,slen-i).equals("dreamer")){
        i += 7;
        continue;
      }else{//どの条件にも適合しないので、等しくならない
        System.out.println("NO");
        return;
      } s.substring(slen-6-i,slen-i).equals("eraser") s.substring(slen-6-i,slen-i).equals s.substring(slen-6-i,slen-i) s.substring s slen-6-i slen-6-i slen 6 i slen-i slen i "eraser" {
        i += 6;
        continue;
      } i += 6 i 6 continue; if(s.substring(slen-7-i,slen-i).equals("dreamer")){
        i += 7;
        continue;
      }else{//どの条件にも適合しないので、等しくならない
        System.out.println("NO");
        return;
      } s.substring(slen-7-i,slen-i).equals("dreamer") s.substring(slen-7-i,slen-i).equals s.substring(slen-7-i,slen-i) s.substring s slen-7-i slen-7-i slen 7 i slen-i slen i "dreamer" {
        i += 7;
        continue;
      } i += 7 i 7 continue; {//どの条件にも適合しないので、等しくならない
        System.out.println("NO");
        return;
      } System.out.println("NO") System.out.println System.out System System.out "NO" return; System.out.println("YES") System.out.println System.out System System.out "YES" String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int slen = s.length();
    String t = "";
    int i = 0;
    while(i < slen){
      //いろいろ判断。適合すれば、文字数分iをずらす
      if(s.substring(slen-5-i,slen-i).equals("dream") || s.substring(slen-5-i,slen-i).equals("erase")){
        i += 5;
        continue;
      }else if(s.substring(slen-6-i,slen-i).equals("eraser")){
        i += 6;
        continue;
      }else if(s.substring(slen-7-i,slen-i).equals("dreamer")){
        i += 7;
        continue;
      }else{//どの条件にも適合しないので、等しくならない
        System.out.println("NO");
        return;
      }
    }
    System.out.println("YES");
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int slen = s.length();
    String t = "";
    int i = 0;
    while(i < slen){
      //いろいろ判断。適合すれば、文字数分iをずらす
      if(s.substring(slen-5-i,slen-i).equals("dream") || s.substring(slen-5-i,slen-i).equals("erase")){
        i += 5;
        continue;
      }else if(s.substring(slen-6-i,slen-i).equals("eraser")){
        i += 6;
        continue;
      }else if(s.substring(slen-7-i,slen-i).equals("dreamer")){
        i += 7;
        continue;
      }else{//どの条件にも適合しないので、等しくならない
        System.out.println("NO");
        return;
      }
    }
    System.out.println("YES");
  }
} Main
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int slen = s.length();
    String t = "";
    int i = 0;
    while(i < slen){
      //いろいろ判断。適合すれば、文字数分iをずらす
      if(s.substring(slen-5-i,slen-i).equals("dream") || s.substring(slen-5-i,slen-i).equals("erase")){
        i += 5;
        continue;
      }else if(s.substring(slen-6-i,slen-i).equals("eraser")){
        i += 6;
        continue;
      }else if(s.substring(slen-7-i,slen-i).equals("dreamer")){
        i += 7;
        continue;
      }else{//どの条件にも適合しないので、等しくならない
        System.out.println("NO");
        return;
      }
    }
    System.out.println("YES");
  }
}
