import java.util.Scanner;
import java.util.Arrays;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        s = reverse(s);
        String[] divide = {"dream","dreamer","erase","eraser"};
        for(int i = 0;i < 4;i++){
            divide[i] = reverse(divide[i]);
        }
        //System.out.println("divide = " + Arrays.toString(divide));
        //System.out.println("s = " + s);
        boolean can = true;
        for(int i = 0;i < s.length();){
            boolean can2 = false;
            for(int j = 0;j < 4;j++){
                String d = divide[j];
                //System.out.printf("divide[%d] = %s\n",j,d);
                if(i + d.length() <= s.length() && s.substring(i,i+d.length()).equals(d)){
                    can2 = true;
                    i += d.length();
                }
                //System.out.println("d = " + d.length());
                //System.out.println("i = " + i);
            }
            if(!can2){
                can = false;
                break;
            }
        }
        if(can){
            System.out.println("YES");
            return;
        }
        System.out.println("NO");
    }
    public static String reverse(String s){
        StringBuffer sb = new StringBuffer(s);
        String sr = new String(sb.reverse());
        return sr;
    }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        s = reverse(s);
        String[] divide = {"dream","dreamer","erase","eraser"};
        for(int i = 0;i < 4;i++){
            divide[i] = reverse(divide[i]);
        }
        //System.out.println("divide = " + Arrays.toString(divide));
        //System.out.println("s = " + s);
        boolean can = true;
        for(int i = 0;i < s.length();){
            boolean can2 = false;
            for(int j = 0;j < 4;j++){
                String d = divide[j];
                //System.out.printf("divide[%d] = %s\n",j,d);
                if(i + d.length() <= s.length() && s.substring(i,i+d.length()).equals(d)){
                    can2 = true;
                    i += d.length();
                }
                //System.out.println("d = " + d.length());
                //System.out.println("i = " + i);
            }
            if(!can2){
                can = false;
                break;
            }
        }
        if(can){
            System.out.println("YES");
            return;
        }
        System.out.println("NO");
    }
    public static String reverse(String s){
        StringBuffer sb = new StringBuffer(s);
        String sr = new String(sb.reverse());
        return sr;
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        s = reverse(s);
        String[] divide = {"dream","dreamer","erase","eraser"};
        for(int i = 0;i < 4;i++){
            divide[i] = reverse(divide[i]);
        }
        //System.out.println("divide = " + Arrays.toString(divide));
        //System.out.println("s = " + s);
        boolean can = true;
        for(int i = 0;i < s.length();){
            boolean can2 = false;
            for(int j = 0;j < 4;j++){
                String d = divide[j];
                //System.out.printf("divide[%d] = %s\n",j,d);
                if(i + d.length() <= s.length() && s.substring(i,i+d.length()).equals(d)){
                    can2 = true;
                    i += d.length();
                }
                //System.out.println("d = " + d.length());
                //System.out.println("i = " + i);
            }
            if(!can2){
                can = false;
                break;
            }
        }
        if(can){
            System.out.println("YES");
            return;
        }
        System.out.println("NO");
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        s = reverse(s);
        String[] divide = {"dream","dreamer","erase","eraser"};
        for(int i = 0;i < 4;i++){
            divide[i] = reverse(divide[i]);
        }
        //System.out.println("divide = " + Arrays.toString(divide));
        //System.out.println("s = " + s);
        boolean can = true;
        for(int i = 0;i < s.length();){
            boolean can2 = false;
            for(int j = 0;j < 4;j++){
                String d = divide[j];
                //System.out.printf("divide[%d] = %s\n",j,d);
                if(i + d.length() <= s.length() && s.substring(i,i+d.length()).equals(d)){
                    can2 = true;
                    i += d.length();
                }
                //System.out.println("d = " + d.length());
                //System.out.println("i = " + i);
            }
            if(!can2){
                can = false;
                break;
            }
        }
        if(can){
            System.out.println("YES");
            return;
        }
        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 s = reverse(s) s reverse(s) reverse s String[] divide = {"dream","dreamer","erase","eraser"}; divide {"dream","dreamer","erase","eraser"} "dream" "dreamer" "erase" "eraser" for(int i = 0;i < 4;i++){
            divide[i] = reverse(divide[i]);
        } int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
            divide[i] = reverse(divide[i]);
        } {
            divide[i] = reverse(divide[i]);
        } divide[i] = reverse(divide[i]) divide[i] divide i reverse(divide[i]) reverse divide[i] divide i boolean can = true; can true for(int i = 0;i < s.length();){
            boolean can2 = false;
            for(int j = 0;j < 4;j++){
                String d = divide[j];
                //System.out.printf("divide[%d] = %s\n",j,d);
                if(i + d.length() <= s.length() && s.substring(i,i+d.length()).equals(d)){
                    can2 = true;
                    i += d.length();
                }
                //System.out.println("d = " + d.length());
                //System.out.println("i = " + i);
            }
            if(!can2){
                can = false;
                break;
            }
        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s {
            boolean can2 = false;
            for(int j = 0;j < 4;j++){
                String d = divide[j];
                //System.out.printf("divide[%d] = %s\n",j,d);
                if(i + d.length() <= s.length() && s.substring(i,i+d.length()).equals(d)){
                    can2 = true;
                    i += d.length();
                }
                //System.out.println("d = " + d.length());
                //System.out.println("i = " + i);
            }
            if(!can2){
                can = false;
                break;
            }
        } {
            boolean can2 = false;
            for(int j = 0;j < 4;j++){
                String d = divide[j];
                //System.out.printf("divide[%d] = %s\n",j,d);
                if(i + d.length() <= s.length() && s.substring(i,i+d.length()).equals(d)){
                    can2 = true;
                    i += d.length();
                }
                //System.out.println("d = " + d.length());
                //System.out.println("i = " + i);
            }
            if(!can2){
                can = false;
                break;
            }
        } boolean can2 = false; can2 false for(int j = 0;j < 4;j++){
                String d = divide[j];
                //System.out.printf("divide[%d] = %s\n",j,d);
                if(i + d.length() <= s.length() && s.substring(i,i+d.length()).equals(d)){
                    can2 = true;
                    i += d.length();
                }
                //System.out.println("d = " + d.length());
                //System.out.println("i = " + i);
            } int j = 0; int j = 0; j 0 j < 4 j 4 j++ j++ j {
                String d = divide[j];
                //System.out.printf("divide[%d] = %s\n",j,d);
                if(i + d.length() <= s.length() && s.substring(i,i+d.length()).equals(d)){
                    can2 = true;
                    i += d.length();
                }
                //System.out.println("d = " + d.length());
                //System.out.println("i = " + i);
            } {
                String d = divide[j];
                //System.out.printf("divide[%d] = %s\n",j,d);
                if(i + d.length() <= s.length() && s.substring(i,i+d.length()).equals(d)){
                    can2 = true;
                    i += d.length();
                }
                //System.out.println("d = " + d.length());
                //System.out.println("i = " + i);
            } String d = divide[j]; d divide[j] divide j if(i + d.length() <= s.length() && s.substring(i,i+d.length()).equals(d)){
                    can2 = true;
                    i += d.length();
                } i + d.length() <= s.length() && s.substring(i,i+d.length()).equals(d) i + d.length() <= s.length() i + d.length() i d.length() d.length d s.length() s.length s s.substring(i,i+d.length()).equals(d) s.substring(i,i+d.length()).equals s.substring(i,i+d.length()) s.substring s i i+d.length() i d.length() d.length d d {
                    can2 = true;
                    i += d.length();
                } can2 = true can2 true i += d.length() i d.length() d.length d if(!can2){
                can = false;
                break;
            } !can2 can2 {
                can = false;
                break;
            } can = false can false break; if(can){
            System.out.println("YES");
            return;
        } can {
            System.out.println("YES");
            return;
        } System.out.println("YES") System.out.println System.out System System.out "YES" return; System.out.println("NO") System.out.println System.out System System.out "NO" String[] args args public static String reverse(String s){
        StringBuffer sb = new StringBuffer(s);
        String sr = new String(sb.reverse());
        return sr;
    } reverse {
        StringBuffer sb = new StringBuffer(s);
        String sr = new String(sb.reverse());
        return sr;
    } StringBuffer sb = new StringBuffer(s); sb new StringBuffer(s) String sr = new String(sb.reverse()); sr new String(sb.reverse()) return sr; sr String s s public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        s = reverse(s);
        String[] divide = {"dream","dreamer","erase","eraser"};
        for(int i = 0;i < 4;i++){
            divide[i] = reverse(divide[i]);
        }
        //System.out.println("divide = " + Arrays.toString(divide));
        //System.out.println("s = " + s);
        boolean can = true;
        for(int i = 0;i < s.length();){
            boolean can2 = false;
            for(int j = 0;j < 4;j++){
                String d = divide[j];
                //System.out.printf("divide[%d] = %s\n",j,d);
                if(i + d.length() <= s.length() && s.substring(i,i+d.length()).equals(d)){
                    can2 = true;
                    i += d.length();
                }
                //System.out.println("d = " + d.length());
                //System.out.println("i = " + i);
            }
            if(!can2){
                can = false;
                break;
            }
        }
        if(can){
            System.out.println("YES");
            return;
        }
        System.out.println("NO");
    }
    public static String reverse(String s){
        StringBuffer sb = new StringBuffer(s);
        String sr = new String(sb.reverse());
        return sr;
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        s = reverse(s);
        String[] divide = {"dream","dreamer","erase","eraser"};
        for(int i = 0;i < 4;i++){
            divide[i] = reverse(divide[i]);
        }
        //System.out.println("divide = " + Arrays.toString(divide));
        //System.out.println("s = " + s);
        boolean can = true;
        for(int i = 0;i < s.length();){
            boolean can2 = false;
            for(int j = 0;j < 4;j++){
                String d = divide[j];
                //System.out.printf("divide[%d] = %s\n",j,d);
                if(i + d.length() <= s.length() && s.substring(i,i+d.length()).equals(d)){
                    can2 = true;
                    i += d.length();
                }
                //System.out.println("d = " + d.length());
                //System.out.println("i = " + i);
            }
            if(!can2){
                can = false;
                break;
            }
        }
        if(can){
            System.out.println("YES");
            return;
        }
        System.out.println("NO");
    }
    public static String reverse(String s){
        StringBuffer sb = new StringBuffer(s);
        String sr = new String(sb.reverse());
        return sr;
    }
} Main
import java.util.Scanner;
import java.util.Arrays;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        s = reverse(s);
        String[] divide = {"dream","dreamer","erase","eraser"};
        for(int i = 0;i < 4;i++){
            divide[i] = reverse(divide[i]);
        }
        //System.out.println("divide = " + Arrays.toString(divide));
        //System.out.println("s = " + s);
        boolean can = true;
        for(int i = 0;i < s.length();){
            boolean can2 = false;
            for(int j = 0;j < 4;j++){
                String d = divide[j];
                //System.out.printf("divide[%d] = %s\n",j,d);
                if(i + d.length() <= s.length() && s.substring(i,i+d.length()).equals(d)){
                    can2 = true;
                    i += d.length();
                }
                //System.out.println("d = " + d.length());
                //System.out.println("i = " + i);
            }
            if(!can2){
                can = false;
                break;
            }
        }
        if(can){
            System.out.println("YES");
            return;
        }
        System.out.println("NO");
    }
    public static String reverse(String s){
        StringBuffer sb = new StringBuffer(s);
        String sr = new String(sb.reverse());
        return sr;
    }
}
