import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);

        boolean successFlag = true;
        String str = "";
        String str_tmp = "";
        String S = sc.next();
        sc.close();
        String[] divide = {"dream", "dreamer", "erase", "eraser"};
        
        // 試験対象の文字列を反転させ、前方一致判定の誤りを防ぐ
        StringBuffer sb = new StringBuffer(S);
		S = sb.reverse().toString();
		for (int i = 0; i < 4; i++) {
		    sb = new StringBuffer(divide[i]);
		    divide[i] = sb.reverse().toString();
		}
		//System.out.println(S);
        
        for (int i = 0; i < S.length();) {
            boolean loopFlag = false;

            for (int j = 0; j < 4; j++){
                
                // 一時変数に1文節代入
                str = divide[j];
                //System.out.println(str);
            
                // 分割できるか判定
                //System.out.println(i+" "+S.length());
                //System.out.println("分割前："+str);
                //System.out.println(S.substring(i, str.length()));
                //if (str.length() + i <= S.length()) {
                //    System.out.println("分割対象："+S.substring(i, str.length() + i));
                //}
                
                // 入力文字数を超えず、なおかつ分割可能な場合、分割開始位置iに文節の文字数を足す
                if (str.length() + i <= S.length()) {
                    if (S.substring(i, str.length() + i).equals(str)) {
                        //System.out.println("分割成功："+str.length());
                        loopFlag = true;
                        i += str.length();
                        break;
                    }
                }

            }
            // どの文節でも分割できない場合失敗
            if ( !loopFlag ) {
                successFlag = false;
                break;
            }
        }
        
        if (successFlag) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

    }
}
 import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);

        boolean successFlag = true;
        String str = "";
        String str_tmp = "";
        String S = sc.next();
        sc.close();
        String[] divide = {"dream", "dreamer", "erase", "eraser"};
        
        // 試験対象の文字列を反転させ、前方一致判定の誤りを防ぐ
        StringBuffer sb = new StringBuffer(S);
		S = sb.reverse().toString();
		for (int i = 0; i < 4; i++) {
		    sb = new StringBuffer(divide[i]);
		    divide[i] = sb.reverse().toString();
		}
		//System.out.println(S);
        
        for (int i = 0; i < S.length();) {
            boolean loopFlag = false;

            for (int j = 0; j < 4; j++){
                
                // 一時変数に1文節代入
                str = divide[j];
                //System.out.println(str);
            
                // 分割できるか判定
                //System.out.println(i+" "+S.length());
                //System.out.println("分割前："+str);
                //System.out.println(S.substring(i, str.length()));
                //if (str.length() + i <= S.length()) {
                //    System.out.println("分割対象："+S.substring(i, str.length() + i));
                //}
                
                // 入力文字数を超えず、なおかつ分割可能な場合、分割開始位置iに文節の文字数を足す
                if (str.length() + i <= S.length()) {
                    if (S.substring(i, str.length() + i).equals(str)) {
                        //System.out.println("分割成功："+str.length());
                        loopFlag = true;
                        i += str.length();
                        break;
                    }
                }

            }
            // どの文節でも分割できない場合失敗
            if ( !loopFlag ) {
                successFlag = false;
                break;
            }
        }
        
        if (successFlag) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

    }
} Main public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);

        boolean successFlag = true;
        String str = "";
        String str_tmp = "";
        String S = sc.next();
        sc.close();
        String[] divide = {"dream", "dreamer", "erase", "eraser"};
        
        // 試験対象の文字列を反転させ、前方一致判定の誤りを防ぐ
        StringBuffer sb = new StringBuffer(S);
		S = sb.reverse().toString();
		for (int i = 0; i < 4; i++) {
		    sb = new StringBuffer(divide[i]);
		    divide[i] = sb.reverse().toString();
		}
		//System.out.println(S);
        
        for (int i = 0; i < S.length();) {
            boolean loopFlag = false;

            for (int j = 0; j < 4; j++){
                
                // 一時変数に1文節代入
                str = divide[j];
                //System.out.println(str);
            
                // 分割できるか判定
                //System.out.println(i+" "+S.length());
                //System.out.println("分割前："+str);
                //System.out.println(S.substring(i, str.length()));
                //if (str.length() + i <= S.length()) {
                //    System.out.println("分割対象："+S.substring(i, str.length() + i));
                //}
                
                // 入力文字数を超えず、なおかつ分割可能な場合、分割開始位置iに文節の文字数を足す
                if (str.length() + i <= S.length()) {
                    if (S.substring(i, str.length() + i).equals(str)) {
                        //System.out.println("分割成功："+str.length());
                        loopFlag = true;
                        i += str.length();
                        break;
                    }
                }

            }
            // どの文節でも分割できない場合失敗
            if ( !loopFlag ) {
                successFlag = false;
                break;
            }
        }
        
        if (successFlag) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

    } main {
        
        Scanner sc = new Scanner(System.in);

        boolean successFlag = true;
        String str = "";
        String str_tmp = "";
        String S = sc.next();
        sc.close();
        String[] divide = {"dream", "dreamer", "erase", "eraser"};
        
        // 試験対象の文字列を反転させ、前方一致判定の誤りを防ぐ
        StringBuffer sb = new StringBuffer(S);
		S = sb.reverse().toString();
		for (int i = 0; i < 4; i++) {
		    sb = new StringBuffer(divide[i]);
		    divide[i] = sb.reverse().toString();
		}
		//System.out.println(S);
        
        for (int i = 0; i < S.length();) {
            boolean loopFlag = false;

            for (int j = 0; j < 4; j++){
                
                // 一時変数に1文節代入
                str = divide[j];
                //System.out.println(str);
            
                // 分割できるか判定
                //System.out.println(i+" "+S.length());
                //System.out.println("分割前："+str);
                //System.out.println(S.substring(i, str.length()));
                //if (str.length() + i <= S.length()) {
                //    System.out.println("分割対象："+S.substring(i, str.length() + i));
                //}
                
                // 入力文字数を超えず、なおかつ分割可能な場合、分割開始位置iに文節の文字数を足す
                if (str.length() + i <= S.length()) {
                    if (S.substring(i, str.length() + i).equals(str)) {
                        //System.out.println("分割成功："+str.length());
                        loopFlag = true;
                        i += str.length();
                        break;
                    }
                }

            }
            // どの文節でも分割できない場合失敗
            if ( !loopFlag ) {
                successFlag = false;
                break;
            }
        }
        
        if (successFlag) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) boolean successFlag = true; successFlag true String str = ""; str "" String str_tmp = ""; str_tmp "" String S = sc.next(); S sc.next() sc.next sc sc.close() sc.close sc String[] divide = {"dream", "dreamer", "erase", "eraser"}; divide {"dream", "dreamer", "erase", "eraser"} "dream" "dreamer" "erase" "eraser" StringBuffer sb = new StringBuffer(S); sb new StringBuffer(S) S = sb.reverse().toString() S sb.reverse().toString() sb.reverse().toString sb.reverse() sb.reverse sb for (int i = 0; i < 4; i++) {
		    sb = new StringBuffer(divide[i]);
		    divide[i] = sb.reverse().toString();
		} int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
		    sb = new StringBuffer(divide[i]);
		    divide[i] = sb.reverse().toString();
		} {
		    sb = new StringBuffer(divide[i]);
		    divide[i] = sb.reverse().toString();
		} sb = new StringBuffer(divide[i]) sb new StringBuffer(divide[i]) divide[i] = sb.reverse().toString() divide[i] divide i sb.reverse().toString() sb.reverse().toString sb.reverse() sb.reverse sb for (int i = 0; i < S.length();) {
            boolean loopFlag = false;

            for (int j = 0; j < 4; j++){
                
                // 一時変数に1文節代入
                str = divide[j];
                //System.out.println(str);
            
                // 分割できるか判定
                //System.out.println(i+" "+S.length());
                //System.out.println("分割前："+str);
                //System.out.println(S.substring(i, str.length()));
                //if (str.length() + i <= S.length()) {
                //    System.out.println("分割対象："+S.substring(i, str.length() + i));
                //}
                
                // 入力文字数を超えず、なおかつ分割可能な場合、分割開始位置iに文節の文字数を足す
                if (str.length() + i <= S.length()) {
                    if (S.substring(i, str.length() + i).equals(str)) {
                        //System.out.println("分割成功："+str.length());
                        loopFlag = true;
                        i += str.length();
                        break;
                    }
                }

            }
            // どの文節でも分割できない場合失敗
            if ( !loopFlag ) {
                successFlag = false;
                break;
            }
        } int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S {
            boolean loopFlag = false;

            for (int j = 0; j < 4; j++){
                
                // 一時変数に1文節代入
                str = divide[j];
                //System.out.println(str);
            
                // 分割できるか判定
                //System.out.println(i+" "+S.length());
                //System.out.println("分割前："+str);
                //System.out.println(S.substring(i, str.length()));
                //if (str.length() + i <= S.length()) {
                //    System.out.println("分割対象："+S.substring(i, str.length() + i));
                //}
                
                // 入力文字数を超えず、なおかつ分割可能な場合、分割開始位置iに文節の文字数を足す
                if (str.length() + i <= S.length()) {
                    if (S.substring(i, str.length() + i).equals(str)) {
                        //System.out.println("分割成功："+str.length());
                        loopFlag = true;
                        i += str.length();
                        break;
                    }
                }

            }
            // どの文節でも分割できない場合失敗
            if ( !loopFlag ) {
                successFlag = false;
                break;
            }
        } {
            boolean loopFlag = false;

            for (int j = 0; j < 4; j++){
                
                // 一時変数に1文節代入
                str = divide[j];
                //System.out.println(str);
            
                // 分割できるか判定
                //System.out.println(i+" "+S.length());
                //System.out.println("分割前："+str);
                //System.out.println(S.substring(i, str.length()));
                //if (str.length() + i <= S.length()) {
                //    System.out.println("分割対象："+S.substring(i, str.length() + i));
                //}
                
                // 入力文字数を超えず、なおかつ分割可能な場合、分割開始位置iに文節の文字数を足す
                if (str.length() + i <= S.length()) {
                    if (S.substring(i, str.length() + i).equals(str)) {
                        //System.out.println("分割成功："+str.length());
                        loopFlag = true;
                        i += str.length();
                        break;
                    }
                }

            }
            // どの文節でも分割できない場合失敗
            if ( !loopFlag ) {
                successFlag = false;
                break;
            }
        } boolean loopFlag = false; loopFlag false for (int j = 0; j < 4; j++){
                
                // 一時変数に1文節代入
                str = divide[j];
                //System.out.println(str);
            
                // 分割できるか判定
                //System.out.println(i+" "+S.length());
                //System.out.println("分割前："+str);
                //System.out.println(S.substring(i, str.length()));
                //if (str.length() + i <= S.length()) {
                //    System.out.println("分割対象："+S.substring(i, str.length() + i));
                //}
                
                // 入力文字数を超えず、なおかつ分割可能な場合、分割開始位置iに文節の文字数を足す
                if (str.length() + i <= S.length()) {
                    if (S.substring(i, str.length() + i).equals(str)) {
                        //System.out.println("分割成功："+str.length());
                        loopFlag = true;
                        i += str.length();
                        break;
                    }
                }

            } int j = 0; int j = 0; j 0 j < 4 j 4 j++ j++ j {
                
                // 一時変数に1文節代入
                str = divide[j];
                //System.out.println(str);
            
                // 分割できるか判定
                //System.out.println(i+" "+S.length());
                //System.out.println("分割前："+str);
                //System.out.println(S.substring(i, str.length()));
                //if (str.length() + i <= S.length()) {
                //    System.out.println("分割対象："+S.substring(i, str.length() + i));
                //}
                
                // 入力文字数を超えず、なおかつ分割可能な場合、分割開始位置iに文節の文字数を足す
                if (str.length() + i <= S.length()) {
                    if (S.substring(i, str.length() + i).equals(str)) {
                        //System.out.println("分割成功："+str.length());
                        loopFlag = true;
                        i += str.length();
                        break;
                    }
                }

            } {
                
                // 一時変数に1文節代入
                str = divide[j];
                //System.out.println(str);
            
                // 分割できるか判定
                //System.out.println(i+" "+S.length());
                //System.out.println("分割前："+str);
                //System.out.println(S.substring(i, str.length()));
                //if (str.length() + i <= S.length()) {
                //    System.out.println("分割対象："+S.substring(i, str.length() + i));
                //}
                
                // 入力文字数を超えず、なおかつ分割可能な場合、分割開始位置iに文節の文字数を足す
                if (str.length() + i <= S.length()) {
                    if (S.substring(i, str.length() + i).equals(str)) {
                        //System.out.println("分割成功："+str.length());
                        loopFlag = true;
                        i += str.length();
                        break;
                    }
                }

            } str = divide[j] str divide[j] divide j if (str.length() + i <= S.length()) {
                    if (S.substring(i, str.length() + i).equals(str)) {
                        //System.out.println("分割成功："+str.length());
                        loopFlag = true;
                        i += str.length();
                        break;
                    }
                } str.length() + i <= S.length() str.length() + i str.length() str.length str i S.length() S.length S {
                    if (S.substring(i, str.length() + i).equals(str)) {
                        //System.out.println("分割成功："+str.length());
                        loopFlag = true;
                        i += str.length();
                        break;
                    }
                } if (S.substring(i, str.length() + i).equals(str)) {
                        //System.out.println("分割成功："+str.length());
                        loopFlag = true;
                        i += str.length();
                        break;
                    } S.substring(i, str.length() + i).equals(str) S.substring(i, str.length() + i).equals S.substring(i, str.length() + i) S.substring S i str.length() + i str.length() str.length str i str {
                        //System.out.println("分割成功："+str.length());
                        loopFlag = true;
                        i += str.length();
                        break;
                    } loopFlag = true loopFlag true i += str.length() i str.length() str.length str break; if ( !loopFlag ) {
                successFlag = false;
                break;
            } !loopFlag loopFlag {
                successFlag = false;
                break;
            } successFlag = false successFlag false break; if (successFlag) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        } successFlag {
            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) throws Exception {
        
        Scanner sc = new Scanner(System.in);

        boolean successFlag = true;
        String str = "";
        String str_tmp = "";
        String S = sc.next();
        sc.close();
        String[] divide = {"dream", "dreamer", "erase", "eraser"};
        
        // 試験対象の文字列を反転させ、前方一致判定の誤りを防ぐ
        StringBuffer sb = new StringBuffer(S);
		S = sb.reverse().toString();
		for (int i = 0; i < 4; i++) {
		    sb = new StringBuffer(divide[i]);
		    divide[i] = sb.reverse().toString();
		}
		//System.out.println(S);
        
        for (int i = 0; i < S.length();) {
            boolean loopFlag = false;

            for (int j = 0; j < 4; j++){
                
                // 一時変数に1文節代入
                str = divide[j];
                //System.out.println(str);
            
                // 分割できるか判定
                //System.out.println(i+" "+S.length());
                //System.out.println("分割前："+str);
                //System.out.println(S.substring(i, str.length()));
                //if (str.length() + i <= S.length()) {
                //    System.out.println("分割対象："+S.substring(i, str.length() + i));
                //}
                
                // 入力文字数を超えず、なおかつ分割可能な場合、分割開始位置iに文節の文字数を足す
                if (str.length() + i <= S.length()) {
                    if (S.substring(i, str.length() + i).equals(str)) {
                        //System.out.println("分割成功："+str.length());
                        loopFlag = true;
                        i += str.length();
                        break;
                    }
                }

            }
            // どの文節でも分割できない場合失敗
            if ( !loopFlag ) {
                successFlag = false;
                break;
            }
        }
        
        if (successFlag) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

    }
} public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);

        boolean successFlag = true;
        String str = "";
        String str_tmp = "";
        String S = sc.next();
        sc.close();
        String[] divide = {"dream", "dreamer", "erase", "eraser"};
        
        // 試験対象の文字列を反転させ、前方一致判定の誤りを防ぐ
        StringBuffer sb = new StringBuffer(S);
		S = sb.reverse().toString();
		for (int i = 0; i < 4; i++) {
		    sb = new StringBuffer(divide[i]);
		    divide[i] = sb.reverse().toString();
		}
		//System.out.println(S);
        
        for (int i = 0; i < S.length();) {
            boolean loopFlag = false;

            for (int j = 0; j < 4; j++){
                
                // 一時変数に1文節代入
                str = divide[j];
                //System.out.println(str);
            
                // 分割できるか判定
                //System.out.println(i+" "+S.length());
                //System.out.println("分割前："+str);
                //System.out.println(S.substring(i, str.length()));
                //if (str.length() + i <= S.length()) {
                //    System.out.println("分割対象："+S.substring(i, str.length() + i));
                //}
                
                // 入力文字数を超えず、なおかつ分割可能な場合、分割開始位置iに文節の文字数を足す
                if (str.length() + i <= S.length()) {
                    if (S.substring(i, str.length() + i).equals(str)) {
                        //System.out.println("分割成功："+str.length());
                        loopFlag = true;
                        i += str.length();
                        break;
                    }
                }

            }
            // どの文節でも分割できない場合失敗
            if ( !loopFlag ) {
                successFlag = false;
                break;
            }
        }
        
        if (successFlag) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);

        boolean successFlag = true;
        String str = "";
        String str_tmp = "";
        String S = sc.next();
        sc.close();
        String[] divide = {"dream", "dreamer", "erase", "eraser"};
        
        // 試験対象の文字列を反転させ、前方一致判定の誤りを防ぐ
        StringBuffer sb = new StringBuffer(S);
		S = sb.reverse().toString();
		for (int i = 0; i < 4; i++) {
		    sb = new StringBuffer(divide[i]);
		    divide[i] = sb.reverse().toString();
		}
		//System.out.println(S);
        
        for (int i = 0; i < S.length();) {
            boolean loopFlag = false;

            for (int j = 0; j < 4; j++){
                
                // 一時変数に1文節代入
                str = divide[j];
                //System.out.println(str);
            
                // 分割できるか判定
                //System.out.println(i+" "+S.length());
                //System.out.println("分割前："+str);
                //System.out.println(S.substring(i, str.length()));
                //if (str.length() + i <= S.length()) {
                //    System.out.println("分割対象："+S.substring(i, str.length() + i));
                //}
                
                // 入力文字数を超えず、なおかつ分割可能な場合、分割開始位置iに文節の文字数を足す
                if (str.length() + i <= S.length()) {
                    if (S.substring(i, str.length() + i).equals(str)) {
                        //System.out.println("分割成功："+str.length());
                        loopFlag = true;
                        i += str.length();
                        break;
                    }
                }

            }
            // どの文節でも分割できない場合失敗
            if ( !loopFlag ) {
                successFlag = false;
                break;
            }
        }
        
        if (successFlag) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

    }
}

