import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    StringBuilder SS = new StringBuilder(S);
    int N = SS.length(), check =0;
    SS = SS.reverse();    
    while (true) {
      if (N >= 5) {
        if (SS.substring(0,5).equals("esare") || SS.substring(0,5).equals("maerd")) {
          SS = SS.delete(0,5);
          N = SS.length();
          continue;
        }
      }
      if (N >= 6) {
        if (SS.substring(0,6).equals("resare")) {
          SS = SS.delete(0,6);
          N = SS.length();
          continue;
        }
      }
      if (N >= 7) { 
        if (SS.substring(0,7).equals("remaerd")) {
          SS = SS.delete(0,7);
          N = SS.length();
          continue;
        }
      }
      break;
    }
    if (N == 0) {
      System.out.println("YES");
    } else {
      System.out.println("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();
    StringBuilder SS = new StringBuilder(S);
    int N = SS.length(), check =0;
    SS = SS.reverse();    
    while (true) {
      if (N >= 5) {
        if (SS.substring(0,5).equals("esare") || SS.substring(0,5).equals("maerd")) {
          SS = SS.delete(0,5);
          N = SS.length();
          continue;
        }
      }
      if (N >= 6) {
        if (SS.substring(0,6).equals("resare")) {
          SS = SS.delete(0,6);
          N = SS.length();
          continue;
        }
      }
      if (N >= 7) { 
        if (SS.substring(0,7).equals("remaerd")) {
          SS = SS.delete(0,7);
          N = SS.length();
          continue;
        }
      }
      break;
    }
    if (N == 0) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  } 
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    StringBuilder SS = new StringBuilder(S);
    int N = SS.length(), check =0;
    SS = SS.reverse();    
    while (true) {
      if (N >= 5) {
        if (SS.substring(0,5).equals("esare") || SS.substring(0,5).equals("maerd")) {
          SS = SS.delete(0,5);
          N = SS.length();
          continue;
        }
      }
      if (N >= 6) {
        if (SS.substring(0,6).equals("resare")) {
          SS = SS.delete(0,6);
          N = SS.length();
          continue;
        }
      }
      if (N >= 7) { 
        if (SS.substring(0,7).equals("remaerd")) {
          SS = SS.delete(0,7);
          N = SS.length();
          continue;
        }
      }
      break;
    }
    if (N == 0) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  } main {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    StringBuilder SS = new StringBuilder(S);
    int N = SS.length(), check =0;
    SS = SS.reverse();    
    while (true) {
      if (N >= 5) {
        if (SS.substring(0,5).equals("esare") || SS.substring(0,5).equals("maerd")) {
          SS = SS.delete(0,5);
          N = SS.length();
          continue;
        }
      }
      if (N >= 6) {
        if (SS.substring(0,6).equals("resare")) {
          SS = SS.delete(0,6);
          N = SS.length();
          continue;
        }
      }
      if (N >= 7) { 
        if (SS.substring(0,7).equals("remaerd")) {
          SS = SS.delete(0,7);
          N = SS.length();
          continue;
        }
      }
      break;
    }
    if (N == 0) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc StringBuilder SS = new StringBuilder(S); SS new StringBuilder(S) int N = SS.length() N SS.length() SS.length SS check =0; check 0 SS = SS.reverse() SS SS.reverse() SS.reverse SS while (true) {
      if (N >= 5) {
        if (SS.substring(0,5).equals("esare") || SS.substring(0,5).equals("maerd")) {
          SS = SS.delete(0,5);
          N = SS.length();
          continue;
        }
      }
      if (N >= 6) {
        if (SS.substring(0,6).equals("resare")) {
          SS = SS.delete(0,6);
          N = SS.length();
          continue;
        }
      }
      if (N >= 7) { 
        if (SS.substring(0,7).equals("remaerd")) {
          SS = SS.delete(0,7);
          N = SS.length();
          continue;
        }
      }
      break;
    } true {
      if (N >= 5) {
        if (SS.substring(0,5).equals("esare") || SS.substring(0,5).equals("maerd")) {
          SS = SS.delete(0,5);
          N = SS.length();
          continue;
        }
      }
      if (N >= 6) {
        if (SS.substring(0,6).equals("resare")) {
          SS = SS.delete(0,6);
          N = SS.length();
          continue;
        }
      }
      if (N >= 7) { 
        if (SS.substring(0,7).equals("remaerd")) {
          SS = SS.delete(0,7);
          N = SS.length();
          continue;
        }
      }
      break;
    } if (N >= 5) {
        if (SS.substring(0,5).equals("esare") || SS.substring(0,5).equals("maerd")) {
          SS = SS.delete(0,5);
          N = SS.length();
          continue;
        }
      } N >= 5 N 5 {
        if (SS.substring(0,5).equals("esare") || SS.substring(0,5).equals("maerd")) {
          SS = SS.delete(0,5);
          N = SS.length();
          continue;
        }
      } if (SS.substring(0,5).equals("esare") || SS.substring(0,5).equals("maerd")) {
          SS = SS.delete(0,5);
          N = SS.length();
          continue;
        } SS.substring(0,5).equals("esare") || SS.substring(0,5).equals("maerd") SS.substring(0,5).equals("esare") SS.substring(0,5).equals SS.substring(0,5) SS.substring SS 0 5 "esare" SS.substring(0,5).equals("maerd") SS.substring(0,5).equals SS.substring(0,5) SS.substring SS 0 5 "maerd" {
          SS = SS.delete(0,5);
          N = SS.length();
          continue;
        } SS = SS.delete(0,5) SS SS.delete(0,5) SS.delete SS 0 5 N = SS.length() N SS.length() SS.length SS continue; if (N >= 6) {
        if (SS.substring(0,6).equals("resare")) {
          SS = SS.delete(0,6);
          N = SS.length();
          continue;
        }
      } N >= 6 N 6 {
        if (SS.substring(0,6).equals("resare")) {
          SS = SS.delete(0,6);
          N = SS.length();
          continue;
        }
      } if (SS.substring(0,6).equals("resare")) {
          SS = SS.delete(0,6);
          N = SS.length();
          continue;
        } SS.substring(0,6).equals("resare") SS.substring(0,6).equals SS.substring(0,6) SS.substring SS 0 6 "resare" {
          SS = SS.delete(0,6);
          N = SS.length();
          continue;
        } SS = SS.delete(0,6) SS SS.delete(0,6) SS.delete SS 0 6 N = SS.length() N SS.length() SS.length SS continue; if (N >= 7) { 
        if (SS.substring(0,7).equals("remaerd")) {
          SS = SS.delete(0,7);
          N = SS.length();
          continue;
        }
      } N >= 7 N 7 { 
        if (SS.substring(0,7).equals("remaerd")) {
          SS = SS.delete(0,7);
          N = SS.length();
          continue;
        }
      } if (SS.substring(0,7).equals("remaerd")) {
          SS = SS.delete(0,7);
          N = SS.length();
          continue;
        } SS.substring(0,7).equals("remaerd") SS.substring(0,7).equals SS.substring(0,7) SS.substring SS 0 7 "remaerd" {
          SS = SS.delete(0,7);
          N = SS.length();
          continue;
        } SS = SS.delete(0,7) SS SS.delete(0,7) SS.delete SS 0 7 N = SS.length() N SS.length() SS.length SS continue; break; if (N == 0) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    } N == 0 N 0 {
      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) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    StringBuilder SS = new StringBuilder(S);
    int N = SS.length(), check =0;
    SS = SS.reverse();    
    while (true) {
      if (N >= 5) {
        if (SS.substring(0,5).equals("esare") || SS.substring(0,5).equals("maerd")) {
          SS = SS.delete(0,5);
          N = SS.length();
          continue;
        }
      }
      if (N >= 6) {
        if (SS.substring(0,6).equals("resare")) {
          SS = SS.delete(0,6);
          N = SS.length();
          continue;
        }
      }
      if (N >= 7) { 
        if (SS.substring(0,7).equals("remaerd")) {
          SS = SS.delete(0,7);
          N = SS.length();
          continue;
        }
      }
      break;
    }
    if (N == 0) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  } 
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    StringBuilder SS = new StringBuilder(S);
    int N = SS.length(), check =0;
    SS = SS.reverse();    
    while (true) {
      if (N >= 5) {
        if (SS.substring(0,5).equals("esare") || SS.substring(0,5).equals("maerd")) {
          SS = SS.delete(0,5);
          N = SS.length();
          continue;
        }
      }
      if (N >= 6) {
        if (SS.substring(0,6).equals("resare")) {
          SS = SS.delete(0,6);
          N = SS.length();
          continue;
        }
      }
      if (N >= 7) { 
        if (SS.substring(0,7).equals("remaerd")) {
          SS = SS.delete(0,7);
          N = SS.length();
          continue;
        }
      }
      break;
    }
    if (N == 0) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  } 
} Main
import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    StringBuilder SS = new StringBuilder(S);
    int N = SS.length(), check =0;
    SS = SS.reverse();    
    while (true) {
      if (N >= 5) {
        if (SS.substring(0,5).equals("esare") || SS.substring(0,5).equals("maerd")) {
          SS = SS.delete(0,5);
          N = SS.length();
          continue;
        }
      }
      if (N >= 6) {
        if (SS.substring(0,6).equals("resare")) {
          SS = SS.delete(0,6);
          N = SS.length();
          continue;
        }
      }
      if (N >= 7) { 
        if (SS.substring(0,7).equals("remaerd")) {
          SS = SS.delete(0,7);
          N = SS.length();
          continue;
        }
      }
      break;
    }
    if (N == 0) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  } 
}