import java.util.Scanner;

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

        if (S.matches("(dream|dreamer|erase|eraser)+?")) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        if (S.matches("(dream|dreamer|erase|eraser)+?")) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        if (S.matches("(dream|dreamer|erase|eraser)+?")) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        if (S.matches("(dream|dreamer|erase|eraser)+?")) {
            System.out.println("YES");
        } else {
            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 if (S.matches("(dream|dreamer|erase|eraser)+?")) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        } S.matches("(dream|dreamer|erase|eraser)+?") S.matches S "(dream|dreamer|erase|eraser)+?" {
            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
import java.util.Scanner;

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

        if (S.matches("(dream|dreamer|erase|eraser)+?")) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}