import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] t = new String[]{"dream", "dreamer", "erase", "eraser"};
        
        boolean[] dp = new boolean[s.length() + 1];
        dp[0] = true;
        
        for(int i = 1; i < dp.length; i++) {
            if(!dp[i - 1]) continue;
            for(int j = 0; j < t.length; j++) {
                if(i - 1 + t[j].length() <= s.length()
                    && s.substring(i-1, i - 1 + t[j].length()).equals(t[j]))
                    dp[i + t[j].length() - 1] = true;
            }
        }
        
        System.out.println(dp[dp.length - 1] ? "YES" : "NO");
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] t = new String[]{"dream", "dreamer", "erase", "eraser"};
        
        boolean[] dp = new boolean[s.length() + 1];
        dp[0] = true;
        
        for(int i = 1; i < dp.length; i++) {
            if(!dp[i - 1]) continue;
            for(int j = 0; j < t.length; j++) {
                if(i - 1 + t[j].length() <= s.length()
                    && s.substring(i-1, i - 1 + t[j].length()).equals(t[j]))
                    dp[i + t[j].length() - 1] = true;
            }
        }
        
        System.out.println(dp[dp.length - 1] ? "YES" : "NO");
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] t = new String[]{"dream", "dreamer", "erase", "eraser"};
        
        boolean[] dp = new boolean[s.length() + 1];
        dp[0] = true;
        
        for(int i = 1; i < dp.length; i++) {
            if(!dp[i - 1]) continue;
            for(int j = 0; j < t.length; j++) {
                if(i - 1 + t[j].length() <= s.length()
                    && s.substring(i-1, i - 1 + t[j].length()).equals(t[j]))
                    dp[i + t[j].length() - 1] = true;
            }
        }
        
        System.out.println(dp[dp.length - 1] ? "YES" : "NO");
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] t = new String[]{"dream", "dreamer", "erase", "eraser"};
        
        boolean[] dp = new boolean[s.length() + 1];
        dp[0] = true;
        
        for(int i = 1; i < dp.length; i++) {
            if(!dp[i - 1]) continue;
            for(int j = 0; j < t.length; j++) {
                if(i - 1 + t[j].length() <= s.length()
                    && s.substring(i-1, i - 1 + t[j].length()).equals(t[j]))
                    dp[i + t[j].length() - 1] = true;
            }
        }
        
        System.out.println(dp[dp.length - 1] ? "YES" : "NO");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String[] t = new String[]{"dream", "dreamer", "erase", "eraser"}; t new String[]{"dream", "dreamer", "erase", "eraser"} boolean[] dp = new boolean[s.length() + 1]; dp new boolean[s.length() + 1] s.length() + 1 s.length() s.length s 1 dp[0] = true dp[0] dp 0 true for(int i = 1; i < dp.length; i++) {
            if(!dp[i - 1]) continue;
            for(int j = 0; j < t.length; j++) {
                if(i - 1 + t[j].length() <= s.length()
                    && s.substring(i-1, i - 1 + t[j].length()).equals(t[j]))
                    dp[i + t[j].length() - 1] = true;
            }
        } int i = 1; int i = 1; i 1 i < dp.length i dp.length dp dp.length i++ i++ i {
            if(!dp[i - 1]) continue;
            for(int j = 0; j < t.length; j++) {
                if(i - 1 + t[j].length() <= s.length()
                    && s.substring(i-1, i - 1 + t[j].length()).equals(t[j]))
                    dp[i + t[j].length() - 1] = true;
            }
        } {
            if(!dp[i - 1]) continue;
            for(int j = 0; j < t.length; j++) {
                if(i - 1 + t[j].length() <= s.length()
                    && s.substring(i-1, i - 1 + t[j].length()).equals(t[j]))
                    dp[i + t[j].length() - 1] = true;
            }
        } if(!dp[i - 1]) continue; !dp[i - 1] dp[i - 1] dp i - 1 i 1 continue; for(int j = 0; j < t.length; j++) {
                if(i - 1 + t[j].length() <= s.length()
                    && s.substring(i-1, i - 1 + t[j].length()).equals(t[j]))
                    dp[i + t[j].length() - 1] = true;
            } int j = 0; int j = 0; j 0 j < t.length j t.length t t.length j++ j++ j {
                if(i - 1 + t[j].length() <= s.length()
                    && s.substring(i-1, i - 1 + t[j].length()).equals(t[j]))
                    dp[i + t[j].length() - 1] = true;
            } {
                if(i - 1 + t[j].length() <= s.length()
                    && s.substring(i-1, i - 1 + t[j].length()).equals(t[j]))
                    dp[i + t[j].length() - 1] = true;
            } if(i - 1 + t[j].length() <= s.length()
                    && s.substring(i-1, i - 1 + t[j].length()).equals(t[j]))
                    dp[i + t[j].length() - 1] = true; i - 1 + t[j].length() <= s.length()
                    && s.substring(i-1, i - 1 + t[j].length()).equals(t[j]) i - 1 + t[j].length() <= s.length() i - 1 + t[j].length() i - 1 i 1 t[j].length() t[j].length t[j] t j s.length() s.length s s.substring(i-1, i - 1 + t[j].length()).equals(t[j]) s.substring(i-1, i - 1 + t[j].length()).equals s.substring(i-1, i - 1 + t[j].length()) s.substring s i-1 i 1 i - 1 + t[j].length() i - 1 i 1 t[j].length() t[j].length t[j] t j t[j] t j dp[i + t[j].length() - 1] = true dp[i + t[j].length() - 1] dp i + t[j].length() - 1 i + t[j].length() i t[j].length() t[j].length t[j] t j 1 true System.out.println(dp[dp.length - 1] ? "YES" : "NO") System.out.println System.out System System.out dp[dp.length - 1] ? "YES" : "NO" dp[dp.length - 1] dp dp.length - 1 dp.length dp dp.length 1 "YES" "NO" String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] t = new String[]{"dream", "dreamer", "erase", "eraser"};
        
        boolean[] dp = new boolean[s.length() + 1];
        dp[0] = true;
        
        for(int i = 1; i < dp.length; i++) {
            if(!dp[i - 1]) continue;
            for(int j = 0; j < t.length; j++) {
                if(i - 1 + t[j].length() <= s.length()
                    && s.substring(i-1, i - 1 + t[j].length()).equals(t[j]))
                    dp[i + t[j].length() - 1] = true;
            }
        }
        
        System.out.println(dp[dp.length - 1] ? "YES" : "NO");
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] t = new String[]{"dream", "dreamer", "erase", "eraser"};
        
        boolean[] dp = new boolean[s.length() + 1];
        dp[0] = true;
        
        for(int i = 1; i < dp.length; i++) {
            if(!dp[i - 1]) continue;
            for(int j = 0; j < t.length; j++) {
                if(i - 1 + t[j].length() <= s.length()
                    && s.substring(i-1, i - 1 + t[j].length()).equals(t[j]))
                    dp[i + t[j].length() - 1] = true;
            }
        }
        
        System.out.println(dp[dp.length - 1] ? "YES" : "NO");
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] t = new String[]{"dream", "dreamer", "erase", "eraser"};
        
        boolean[] dp = new boolean[s.length() + 1];
        dp[0] = true;
        
        for(int i = 1; i < dp.length; i++) {
            if(!dp[i - 1]) continue;
            for(int j = 0; j < t.length; j++) {
                if(i - 1 + t[j].length() <= s.length()
                    && s.substring(i-1, i - 1 + t[j].length()).equals(t[j]))
                    dp[i + t[j].length() - 1] = true;
            }
        }
        
        System.out.println(dp[dp.length - 1] ? "YES" : "NO");
    }
}
