import java.util.*;
import java.util.stream.Collectors;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
      
        String s = sc.next();
        List<String> words = Arrays.asList("dream", "erase", "dreamer", "eraser");

        int tmpIndex = s.length();
        while (true) {
            int tmpIndex2  = tmpIndex;
            for (String word : words) {
                if(s.startsWith(word, tmpIndex - word.length())) {
                    tmpIndex = s.indexOf(word, tmpIndex - word.length());
                    break;

                }
            }

            if (tmpIndex == 0 || tmpIndex == tmpIndex2) {
                break;
            }
        }
        String result = "NO";
        if (tmpIndex == 0) {
            result = "YES";
        }


        System.out.println(result);
    }
} import java.util.*; util.* java import java.util.stream.Collectors; Collectors java.util.stream class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
      
        String s = sc.next();
        List<String> words = Arrays.asList("dream", "erase", "dreamer", "eraser");

        int tmpIndex = s.length();
        while (true) {
            int tmpIndex2  = tmpIndex;
            for (String word : words) {
                if(s.startsWith(word, tmpIndex - word.length())) {
                    tmpIndex = s.indexOf(word, tmpIndex - word.length());
                    break;

                }
            }

            if (tmpIndex == 0 || tmpIndex == tmpIndex2) {
                break;
            }
        }
        String result = "NO";
        if (tmpIndex == 0) {
            result = "YES";
        }


        System.out.println(result);
    }
} Main public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
      
        String s = sc.next();
        List<String> words = Arrays.asList("dream", "erase", "dreamer", "eraser");

        int tmpIndex = s.length();
        while (true) {
            int tmpIndex2  = tmpIndex;
            for (String word : words) {
                if(s.startsWith(word, tmpIndex - word.length())) {
                    tmpIndex = s.indexOf(word, tmpIndex - word.length());
                    break;

                }
            }

            if (tmpIndex == 0 || tmpIndex == tmpIndex2) {
                break;
            }
        }
        String result = "NO";
        if (tmpIndex == 0) {
            result = "YES";
        }


        System.out.println(result);
    } main {
        Scanner sc = new Scanner(System.in);
      
        String s = sc.next();
        List<String> words = Arrays.asList("dream", "erase", "dreamer", "eraser");

        int tmpIndex = s.length();
        while (true) {
            int tmpIndex2  = tmpIndex;
            for (String word : words) {
                if(s.startsWith(word, tmpIndex - word.length())) {
                    tmpIndex = s.indexOf(word, tmpIndex - word.length());
                    break;

                }
            }

            if (tmpIndex == 0 || tmpIndex == tmpIndex2) {
                break;
            }
        }
        String result = "NO";
        if (tmpIndex == 0) {
            result = "YES";
        }


        System.out.println(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc List<String> words = Arrays.asList("dream", "erase", "dreamer", "eraser"); words Arrays.asList("dream", "erase", "dreamer", "eraser") Arrays.asList Arrays "dream" "erase" "dreamer" "eraser" int tmpIndex = s.length(); tmpIndex s.length() s.length s while (true) {
            int tmpIndex2  = tmpIndex;
            for (String word : words) {
                if(s.startsWith(word, tmpIndex - word.length())) {
                    tmpIndex = s.indexOf(word, tmpIndex - word.length());
                    break;

                }
            }

            if (tmpIndex == 0 || tmpIndex == tmpIndex2) {
                break;
            }
        } true {
            int tmpIndex2  = tmpIndex;
            for (String word : words) {
                if(s.startsWith(word, tmpIndex - word.length())) {
                    tmpIndex = s.indexOf(word, tmpIndex - word.length());
                    break;

                }
            }

            if (tmpIndex == 0 || tmpIndex == tmpIndex2) {
                break;
            }
        } int tmpIndex2  = tmpIndex; tmpIndex2 tmpIndex for (String word : words) {
                if(s.startsWith(word, tmpIndex - word.length())) {
                    tmpIndex = s.indexOf(word, tmpIndex - word.length());
                    break;

                }
            } String word words {
                if(s.startsWith(word, tmpIndex - word.length())) {
                    tmpIndex = s.indexOf(word, tmpIndex - word.length());
                    break;

                }
            } {
                if(s.startsWith(word, tmpIndex - word.length())) {
                    tmpIndex = s.indexOf(word, tmpIndex - word.length());
                    break;

                }
            } if(s.startsWith(word, tmpIndex - word.length())) {
                    tmpIndex = s.indexOf(word, tmpIndex - word.length());
                    break;

                } s.startsWith(word, tmpIndex - word.length()) s.startsWith s word tmpIndex - word.length() tmpIndex word.length() word.length word {
                    tmpIndex = s.indexOf(word, tmpIndex - word.length());
                    break;

                } tmpIndex = s.indexOf(word, tmpIndex - word.length()) tmpIndex s.indexOf(word, tmpIndex - word.length()) s.indexOf s word tmpIndex - word.length() tmpIndex word.length() word.length word break; if (tmpIndex == 0 || tmpIndex == tmpIndex2) {
                break;
            } tmpIndex == 0 || tmpIndex == tmpIndex2 tmpIndex == 0 tmpIndex 0 tmpIndex == tmpIndex2 tmpIndex tmpIndex2 {
                break;
            } break; String result = "NO"; result "NO" if (tmpIndex == 0) {
            result = "YES";
        } tmpIndex == 0 tmpIndex 0 {
            result = "YES";
        } result = "YES" result "YES" System.out.println(result) System.out.println System.out System System.out result String args[] args
import java.util.*;
import java.util.stream.Collectors;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
      
        String s = sc.next();
        List<String> words = Arrays.asList("dream", "erase", "dreamer", "eraser");

        int tmpIndex = s.length();
        while (true) {
            int tmpIndex2  = tmpIndex;
            for (String word : words) {
                if(s.startsWith(word, tmpIndex - word.length())) {
                    tmpIndex = s.indexOf(word, tmpIndex - word.length());
                    break;

                }
            }

            if (tmpIndex == 0 || tmpIndex == tmpIndex2) {
                break;
            }
        }
        String result = "NO";
        if (tmpIndex == 0) {
            result = "YES";
        }


        System.out.println(result);
    }
}