import java.util.*;

class Main {
  static String[] strs={
    "dream",
    "dreamer",
    "erase",
    "eraser"
  };

  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    String S=sc.next();

    while (true) {
      boolean endsWithStr=false;
      for (String str: strs) {
        if (S.endsWith(str)) {
          endsWithStr=true;
          S=S.substring(0,S.length()-str.length());
          break;
        }
      }
      if (!endsWithStr) {
        System.out.println("NO");
        break;
      }
      if (S.length()<=0) {
        System.out.println("YES");
        break;
      }
    }
  }
} import java.util.*; util.* java class Main {
  static String[] strs={
    "dream",
    "dreamer",
    "erase",
    "eraser"
  };

  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    String S=sc.next();

    while (true) {
      boolean endsWithStr=false;
      for (String str: strs) {
        if (S.endsWith(str)) {
          endsWithStr=true;
          S=S.substring(0,S.length()-str.length());
          break;
        }
      }
      if (!endsWithStr) {
        System.out.println("NO");
        break;
      }
      if (S.length()<=0) {
        System.out.println("YES");
        break;
      }
    }
  }
} Main static String[] strs={
    "dream",
    "dreamer",
    "erase",
    "eraser"
  }; strs {
    "dream",
    "dreamer",
    "erase",
    "eraser"
  } "dream" "dreamer" "erase" "eraser" public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    String S=sc.next();

    while (true) {
      boolean endsWithStr=false;
      for (String str: strs) {
        if (S.endsWith(str)) {
          endsWithStr=true;
          S=S.substring(0,S.length()-str.length());
          break;
        }
      }
      if (!endsWithStr) {
        System.out.println("NO");
        break;
      }
      if (S.length()<=0) {
        System.out.println("YES");
        break;
      }
    }
  } main {
    Scanner sc=new Scanner(System.in);
    String S=sc.next();

    while (true) {
      boolean endsWithStr=false;
      for (String str: strs) {
        if (S.endsWith(str)) {
          endsWithStr=true;
          S=S.substring(0,S.length()-str.length());
          break;
        }
      }
      if (!endsWithStr) {
        System.out.println("NO");
        break;
      }
      if (S.length()<=0) {
        System.out.println("YES");
        break;
      }
    }
  } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) String S=sc.next(); S sc.next() sc.next sc while (true) {
      boolean endsWithStr=false;
      for (String str: strs) {
        if (S.endsWith(str)) {
          endsWithStr=true;
          S=S.substring(0,S.length()-str.length());
          break;
        }
      }
      if (!endsWithStr) {
        System.out.println("NO");
        break;
      }
      if (S.length()<=0) {
        System.out.println("YES");
        break;
      }
    } true {
      boolean endsWithStr=false;
      for (String str: strs) {
        if (S.endsWith(str)) {
          endsWithStr=true;
          S=S.substring(0,S.length()-str.length());
          break;
        }
      }
      if (!endsWithStr) {
        System.out.println("NO");
        break;
      }
      if (S.length()<=0) {
        System.out.println("YES");
        break;
      }
    } boolean endsWithStr=false; endsWithStr false for (String str: strs) {
        if (S.endsWith(str)) {
          endsWithStr=true;
          S=S.substring(0,S.length()-str.length());
          break;
        }
      } String str strs {
        if (S.endsWith(str)) {
          endsWithStr=true;
          S=S.substring(0,S.length()-str.length());
          break;
        }
      } {
        if (S.endsWith(str)) {
          endsWithStr=true;
          S=S.substring(0,S.length()-str.length());
          break;
        }
      } if (S.endsWith(str)) {
          endsWithStr=true;
          S=S.substring(0,S.length()-str.length());
          break;
        } S.endsWith(str) S.endsWith S str {
          endsWithStr=true;
          S=S.substring(0,S.length()-str.length());
          break;
        } endsWithStr=true endsWithStr true S=S.substring(0,S.length()-str.length()) S S.substring(0,S.length()-str.length()) S.substring S 0 S.length()-str.length() S.length() S.length S str.length() str.length str break; if (!endsWithStr) {
        System.out.println("NO");
        break;
      } !endsWithStr endsWithStr {
        System.out.println("NO");
        break;
      } System.out.println("NO") System.out.println System.out System System.out "NO" break; if (S.length()<=0) {
        System.out.println("YES");
        break;
      } S.length()<=0 S.length() S.length S 0 {
        System.out.println("YES");
        break;
      } System.out.println("YES") System.out.println System.out System System.out "YES" break; String[] args args
import java.util.*;

class Main {
  static String[] strs={
    "dream",
    "dreamer",
    "erase",
    "eraser"
  };

  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    String S=sc.next();

    while (true) {
      boolean endsWithStr=false;
      for (String str: strs) {
        if (S.endsWith(str)) {
          endsWithStr=true;
          S=S.substring(0,S.length()-str.length());
          break;
        }
      }
      if (!endsWithStr) {
        System.out.println("NO");
        break;
      }
      if (S.length()<=0) {
        System.out.println("YES");
        break;
      }
    }
  }
}
