import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final String DREAM = "maerd";
        final String DREAMER = "remaerd";
        final String ERASE = "esare";
        final String ERASER = "resare";
        Scanner sc= new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        String s = sc.next();
        sb.append(s);
        sb.reverse();
        String[] dreams = {DREAM, DREAMER, ERASE, ERASER};
        boolean daydream = true;
        String ans = "NO";
        dd:while(daydream) {
            for(String dre : dreams) {
                if(sb.indexOf(dre) == 0) {
                    sb.replace(0, dre.length(), "");
                    daydream = true;
                    continue dd;
                }
                daydream = false;
            }
        }
        if(sb.length() == 0)ans = "YES";
        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        final String DREAM = "maerd";
        final String DREAMER = "remaerd";
        final String ERASE = "esare";
        final String ERASER = "resare";
        Scanner sc= new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        String s = sc.next();
        sb.append(s);
        sb.reverse();
        String[] dreams = {DREAM, DREAMER, ERASE, ERASER};
        boolean daydream = true;
        String ans = "NO";
        dd:while(daydream) {
            for(String dre : dreams) {
                if(sb.indexOf(dre) == 0) {
                    sb.replace(0, dre.length(), "");
                    daydream = true;
                    continue dd;
                }
                daydream = false;
            }
        }
        if(sb.length() == 0)ans = "YES";
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        final String DREAM = "maerd";
        final String DREAMER = "remaerd";
        final String ERASE = "esare";
        final String ERASER = "resare";
        Scanner sc= new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        String s = sc.next();
        sb.append(s);
        sb.reverse();
        String[] dreams = {DREAM, DREAMER, ERASE, ERASER};
        boolean daydream = true;
        String ans = "NO";
        dd:while(daydream) {
            for(String dre : dreams) {
                if(sb.indexOf(dre) == 0) {
                    sb.replace(0, dre.length(), "");
                    daydream = true;
                    continue dd;
                }
                daydream = false;
            }
        }
        if(sb.length() == 0)ans = "YES";
        System.out.println(ans);
    } main {
        final String DREAM = "maerd";
        final String DREAMER = "remaerd";
        final String ERASE = "esare";
        final String ERASER = "resare";
        Scanner sc= new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        String s = sc.next();
        sb.append(s);
        sb.reverse();
        String[] dreams = {DREAM, DREAMER, ERASE, ERASER};
        boolean daydream = true;
        String ans = "NO";
        dd:while(daydream) {
            for(String dre : dreams) {
                if(sb.indexOf(dre) == 0) {
                    sb.replace(0, dre.length(), "");
                    daydream = true;
                    continue dd;
                }
                daydream = false;
            }
        }
        if(sb.length() == 0)ans = "YES";
        System.out.println(ans);
    } final String DREAM = "maerd"; DREAM "maerd" final String DREAMER = "remaerd"; DREAMER "remaerd" final String ERASE = "esare"; ERASE "esare" final String ERASER = "resare"; ERASER "resare" Scanner sc= new Scanner(System.in); sc new Scanner(System.in) StringBuilder sb = new StringBuilder(); sb new StringBuilder() String s = sc.next(); s sc.next() sc.next sc sb.append(s) sb.append sb s sb.reverse() sb.reverse sb String[] dreams = {DREAM, DREAMER, ERASE, ERASER}; dreams {DREAM, DREAMER, ERASE, ERASER} DREAM DREAMER ERASE ERASER boolean daydream = true; daydream true String ans = "NO"; ans "NO" if(sb.length() == 0)ans = "YES"; sb.length() == 0 sb.length() sb.length sb 0 ans = "YES" ans "YES" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {
        final String DREAM = "maerd";
        final String DREAMER = "remaerd";
        final String ERASE = "esare";
        final String ERASER = "resare";
        Scanner sc= new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        String s = sc.next();
        sb.append(s);
        sb.reverse();
        String[] dreams = {DREAM, DREAMER, ERASE, ERASER};
        boolean daydream = true;
        String ans = "NO";
        dd:while(daydream) {
            for(String dre : dreams) {
                if(sb.indexOf(dre) == 0) {
                    sb.replace(0, dre.length(), "");
                    daydream = true;
                    continue dd;
                }
                daydream = false;
            }
        }
        if(sb.length() == 0)ans = "YES";
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        final String DREAM = "maerd";
        final String DREAMER = "remaerd";
        final String ERASE = "esare";
        final String ERASER = "resare";
        Scanner sc= new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        String s = sc.next();
        sb.append(s);
        sb.reverse();
        String[] dreams = {DREAM, DREAMER, ERASE, ERASER};
        boolean daydream = true;
        String ans = "NO";
        dd:while(daydream) {
            for(String dre : dreams) {
                if(sb.indexOf(dre) == 0) {
                    sb.replace(0, dre.length(), "");
                    daydream = true;
                    continue dd;
                }
                daydream = false;
            }
        }
        if(sb.length() == 0)ans = "YES";
        System.out.println(ans);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final String DREAM = "maerd";
        final String DREAMER = "remaerd";
        final String ERASE = "esare";
        final String ERASER = "resare";
        Scanner sc= new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        String s = sc.next();
        sb.append(s);
        sb.reverse();
        String[] dreams = {DREAM, DREAMER, ERASE, ERASER};
        boolean daydream = true;
        String ans = "NO";
        dd:while(daydream) {
            for(String dre : dreams) {
                if(sb.indexOf(dre) == 0) {
                    sb.replace(0, dre.length(), "");
                    daydream = true;
                    continue dd;
                }
                daydream = false;
            }
        }
        if(sb.length() == 0)ans = "YES";
        System.out.println(ans);
    }
}
