import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String s = scan.next();
    while (s.length() > 0){
      int c = s.length();
      if (c >= 7){
        String check2 = s.substring(0,7);
        if (check2.equals("dreamer")){
          if (s.length() == 7){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(7,g);
            if (s.length() >= 3){
              String cc = s.substring(0,3);
              if (cc.equals("ase")){
                s = "er" + s;
              }
            }
          }
          continue;
        }
      }

      if (c >= 6){
        String check1 = s.substring(0,6);
        if (check1.equals("eraser")){
          if (s.length() == 6){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(6,g);
          }
          continue;
        }
      }

      if (c >= 5){
        String check3 = s.substring(0,5);
        if ((check3.equals("erase")) || (check3.equals("dream"))){
          if (s.length() == 5){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(5,g);
          }
          continue;
        }
      }

      System.out.println("NO");
      return;
    }


  }

} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String s = scan.next();
    while (s.length() > 0){
      int c = s.length();
      if (c >= 7){
        String check2 = s.substring(0,7);
        if (check2.equals("dreamer")){
          if (s.length() == 7){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(7,g);
            if (s.length() >= 3){
              String cc = s.substring(0,3);
              if (cc.equals("ase")){
                s = "er" + s;
              }
            }
          }
          continue;
        }
      }

      if (c >= 6){
        String check1 = s.substring(0,6);
        if (check1.equals("eraser")){
          if (s.length() == 6){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(6,g);
          }
          continue;
        }
      }

      if (c >= 5){
        String check3 = s.substring(0,5);
        if ((check3.equals("erase")) || (check3.equals("dream"))){
          if (s.length() == 5){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(5,g);
          }
          continue;
        }
      }

      System.out.println("NO");
      return;
    }


  }

} Main public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String s = scan.next();
    while (s.length() > 0){
      int c = s.length();
      if (c >= 7){
        String check2 = s.substring(0,7);
        if (check2.equals("dreamer")){
          if (s.length() == 7){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(7,g);
            if (s.length() >= 3){
              String cc = s.substring(0,3);
              if (cc.equals("ase")){
                s = "er" + s;
              }
            }
          }
          continue;
        }
      }

      if (c >= 6){
        String check1 = s.substring(0,6);
        if (check1.equals("eraser")){
          if (s.length() == 6){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(6,g);
          }
          continue;
        }
      }

      if (c >= 5){
        String check3 = s.substring(0,5);
        if ((check3.equals("erase")) || (check3.equals("dream"))){
          if (s.length() == 5){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(5,g);
          }
          continue;
        }
      }

      System.out.println("NO");
      return;
    }


  } main {
    Scanner scan = new Scanner(System.in);
    String s = scan.next();
    while (s.length() > 0){
      int c = s.length();
      if (c >= 7){
        String check2 = s.substring(0,7);
        if (check2.equals("dreamer")){
          if (s.length() == 7){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(7,g);
            if (s.length() >= 3){
              String cc = s.substring(0,3);
              if (cc.equals("ase")){
                s = "er" + s;
              }
            }
          }
          continue;
        }
      }

      if (c >= 6){
        String check1 = s.substring(0,6);
        if (check1.equals("eraser")){
          if (s.length() == 6){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(6,g);
          }
          continue;
        }
      }

      if (c >= 5){
        String check3 = s.substring(0,5);
        if ((check3.equals("erase")) || (check3.equals("dream"))){
          if (s.length() == 5){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(5,g);
          }
          continue;
        }
      }

      System.out.println("NO");
      return;
    }


  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan while (s.length() > 0){
      int c = s.length();
      if (c >= 7){
        String check2 = s.substring(0,7);
        if (check2.equals("dreamer")){
          if (s.length() == 7){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(7,g);
            if (s.length() >= 3){
              String cc = s.substring(0,3);
              if (cc.equals("ase")){
                s = "er" + s;
              }
            }
          }
          continue;
        }
      }

      if (c >= 6){
        String check1 = s.substring(0,6);
        if (check1.equals("eraser")){
          if (s.length() == 6){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(6,g);
          }
          continue;
        }
      }

      if (c >= 5){
        String check3 = s.substring(0,5);
        if ((check3.equals("erase")) || (check3.equals("dream"))){
          if (s.length() == 5){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(5,g);
          }
          continue;
        }
      }

      System.out.println("NO");
      return;
    } s.length() > 0 s.length() s.length s 0 {
      int c = s.length();
      if (c >= 7){
        String check2 = s.substring(0,7);
        if (check2.equals("dreamer")){
          if (s.length() == 7){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(7,g);
            if (s.length() >= 3){
              String cc = s.substring(0,3);
              if (cc.equals("ase")){
                s = "er" + s;
              }
            }
          }
          continue;
        }
      }

      if (c >= 6){
        String check1 = s.substring(0,6);
        if (check1.equals("eraser")){
          if (s.length() == 6){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(6,g);
          }
          continue;
        }
      }

      if (c >= 5){
        String check3 = s.substring(0,5);
        if ((check3.equals("erase")) || (check3.equals("dream"))){
          if (s.length() == 5){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(5,g);
          }
          continue;
        }
      }

      System.out.println("NO");
      return;
    } int c = s.length(); c s.length() s.length s if (c >= 7){
        String check2 = s.substring(0,7);
        if (check2.equals("dreamer")){
          if (s.length() == 7){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(7,g);
            if (s.length() >= 3){
              String cc = s.substring(0,3);
              if (cc.equals("ase")){
                s = "er" + s;
              }
            }
          }
          continue;
        }
      } c >= 7 c 7 {
        String check2 = s.substring(0,7);
        if (check2.equals("dreamer")){
          if (s.length() == 7){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(7,g);
            if (s.length() >= 3){
              String cc = s.substring(0,3);
              if (cc.equals("ase")){
                s = "er" + s;
              }
            }
          }
          continue;
        }
      } String check2 = s.substring(0,7); check2 s.substring(0,7) s.substring s 0 7 if (check2.equals("dreamer")){
          if (s.length() == 7){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(7,g);
            if (s.length() >= 3){
              String cc = s.substring(0,3);
              if (cc.equals("ase")){
                s = "er" + s;
              }
            }
          }
          continue;
        } check2.equals("dreamer") check2.equals check2 "dreamer" {
          if (s.length() == 7){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(7,g);
            if (s.length() >= 3){
              String cc = s.substring(0,3);
              if (cc.equals("ase")){
                s = "er" + s;
              }
            }
          }
          continue;
        } if (s.length() == 7){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(7,g);
            if (s.length() >= 3){
              String cc = s.substring(0,3);
              if (cc.equals("ase")){
                s = "er" + s;
              }
            }
          } s.length() == 7 s.length() s.length s 7 {
            System.out.println("YES");
            return;
          } System.out.println("YES") System.out.println System.out System System.out "YES" return; {
            int g = s.length();
            s = s.substring(7,g);
            if (s.length() >= 3){
              String cc = s.substring(0,3);
              if (cc.equals("ase")){
                s = "er" + s;
              }
            }
          } int g = s.length(); g s.length() s.length s s = s.substring(7,g) s s.substring(7,g) s.substring s 7 g if (s.length() >= 3){
              String cc = s.substring(0,3);
              if (cc.equals("ase")){
                s = "er" + s;
              }
            } s.length() >= 3 s.length() s.length s 3 {
              String cc = s.substring(0,3);
              if (cc.equals("ase")){
                s = "er" + s;
              }
            } String cc = s.substring(0,3); cc s.substring(0,3) s.substring s 0 3 if (cc.equals("ase")){
                s = "er" + s;
              } cc.equals("ase") cc.equals cc "ase" {
                s = "er" + s;
              } s = "er" + s s "er" + s "er" s continue; if (c >= 6){
        String check1 = s.substring(0,6);
        if (check1.equals("eraser")){
          if (s.length() == 6){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(6,g);
          }
          continue;
        }
      } c >= 6 c 6 {
        String check1 = s.substring(0,6);
        if (check1.equals("eraser")){
          if (s.length() == 6){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(6,g);
          }
          continue;
        }
      } String check1 = s.substring(0,6); check1 s.substring(0,6) s.substring s 0 6 if (check1.equals("eraser")){
          if (s.length() == 6){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(6,g);
          }
          continue;
        } check1.equals("eraser") check1.equals check1 "eraser" {
          if (s.length() == 6){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(6,g);
          }
          continue;
        } if (s.length() == 6){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(6,g);
          } s.length() == 6 s.length() s.length s 6 {
            System.out.println("YES");
            return;
          } System.out.println("YES") System.out.println System.out System System.out "YES" return; {
            int g = s.length();
            s = s.substring(6,g);
          } int g = s.length(); g s.length() s.length s s = s.substring(6,g) s s.substring(6,g) s.substring s 6 g continue; if (c >= 5){
        String check3 = s.substring(0,5);
        if ((check3.equals("erase")) || (check3.equals("dream"))){
          if (s.length() == 5){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(5,g);
          }
          continue;
        }
      } c >= 5 c 5 {
        String check3 = s.substring(0,5);
        if ((check3.equals("erase")) || (check3.equals("dream"))){
          if (s.length() == 5){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(5,g);
          }
          continue;
        }
      } String check3 = s.substring(0,5); check3 s.substring(0,5) s.substring s 0 5 if ((check3.equals("erase")) || (check3.equals("dream"))){
          if (s.length() == 5){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(5,g);
          }
          continue;
        } (check3.equals("erase")) || (check3.equals("dream")) (check3.equals("erase")) check3.equals check3 "erase" (check3.equals("dream")) check3.equals check3 "dream" {
          if (s.length() == 5){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(5,g);
          }
          continue;
        } if (s.length() == 5){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(5,g);
          } s.length() == 5 s.length() s.length s 5 {
            System.out.println("YES");
            return;
          } System.out.println("YES") System.out.println System.out System System.out "YES" return; {
            int g = s.length();
            s = s.substring(5,g);
          } int g = s.length(); g s.length() s.length s s = s.substring(5,g) s s.substring(5,g) s.substring s 5 g continue; System.out.println("NO") System.out.println System.out System System.out "NO" return; String[] args args public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String s = scan.next();
    while (s.length() > 0){
      int c = s.length();
      if (c >= 7){
        String check2 = s.substring(0,7);
        if (check2.equals("dreamer")){
          if (s.length() == 7){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(7,g);
            if (s.length() >= 3){
              String cc = s.substring(0,3);
              if (cc.equals("ase")){
                s = "er" + s;
              }
            }
          }
          continue;
        }
      }

      if (c >= 6){
        String check1 = s.substring(0,6);
        if (check1.equals("eraser")){
          if (s.length() == 6){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(6,g);
          }
          continue;
        }
      }

      if (c >= 5){
        String check3 = s.substring(0,5);
        if ((check3.equals("erase")) || (check3.equals("dream"))){
          if (s.length() == 5){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(5,g);
          }
          continue;
        }
      }

      System.out.println("NO");
      return;
    }


  }

} public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String s = scan.next();
    while (s.length() > 0){
      int c = s.length();
      if (c >= 7){
        String check2 = s.substring(0,7);
        if (check2.equals("dreamer")){
          if (s.length() == 7){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(7,g);
            if (s.length() >= 3){
              String cc = s.substring(0,3);
              if (cc.equals("ase")){
                s = "er" + s;
              }
            }
          }
          continue;
        }
      }

      if (c >= 6){
        String check1 = s.substring(0,6);
        if (check1.equals("eraser")){
          if (s.length() == 6){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(6,g);
          }
          continue;
        }
      }

      if (c >= 5){
        String check3 = s.substring(0,5);
        if ((check3.equals("erase")) || (check3.equals("dream"))){
          if (s.length() == 5){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(5,g);
          }
          continue;
        }
      }

      System.out.println("NO");
      return;
    }


  }

} Main
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String s = scan.next();
    while (s.length() > 0){
      int c = s.length();
      if (c >= 7){
        String check2 = s.substring(0,7);
        if (check2.equals("dreamer")){
          if (s.length() == 7){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(7,g);
            if (s.length() >= 3){
              String cc = s.substring(0,3);
              if (cc.equals("ase")){
                s = "er" + s;
              }
            }
          }
          continue;
        }
      }

      if (c >= 6){
        String check1 = s.substring(0,6);
        if (check1.equals("eraser")){
          if (s.length() == 6){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(6,g);
          }
          continue;
        }
      }

      if (c >= 5){
        String check3 = s.substring(0,5);
        if ((check3.equals("erase")) || (check3.equals("dream"))){
          if (s.length() == 5){
            System.out.println("YES");
            return;
          }
          else{
            int g = s.length();
            s = s.substring(5,g);
          }
          continue;
        }
      }

      System.out.println("NO");
      return;
    }


  }

}
