import java.util.Scanner;
import java.util.regex.Pattern;

public class Main {
    private static final Pattern REGREX_PATTERN = Pattern.compile("(dream|dreamer|erase|eraser)*");    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        System.out.println(REGREX_PATTERN.matcher(S).matches() ? "YES" : "NO"); 
    }
} import java.util.Scanner; Scanner java.util import java.util.regex.Pattern; Pattern java.util.regex public class Main {
    private static final Pattern REGREX_PATTERN = Pattern.compile("(dream|dreamer|erase|eraser)*");    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        System.out.println(REGREX_PATTERN.matcher(S).matches() ? "YES" : "NO"); 
    }
} Main private static final Pattern REGREX_PATTERN = Pattern.compile("(dream|dreamer|erase|eraser)*"); REGREX_PATTERN Pattern.compile("(dream|dreamer|erase|eraser)*") Pattern.compile Pattern "(dream|dreamer|erase|eraser)*" public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        System.out.println(REGREX_PATTERN.matcher(S).matches() ? "YES" : "NO"); 
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        System.out.println(REGREX_PATTERN.matcher(S).matches() ? "YES" : "NO"); 
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc System.out.println(REGREX_PATTERN.matcher(S).matches() ? "YES" : "NO") System.out.println System.out System System.out REGREX_PATTERN.matcher(S).matches() ? "YES" : "NO" REGREX_PATTERN.matcher(S).matches() REGREX_PATTERN.matcher(S).matches REGREX_PATTERN.matcher(S) REGREX_PATTERN.matcher REGREX_PATTERN S "YES" "NO" String[] args args public class Main {
    private static final Pattern REGREX_PATTERN = Pattern.compile("(dream|dreamer|erase|eraser)*");    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        System.out.println(REGREX_PATTERN.matcher(S).matches() ? "YES" : "NO"); 
    }
} public class Main {
    private static final Pattern REGREX_PATTERN = Pattern.compile("(dream|dreamer|erase|eraser)*");    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        System.out.println(REGREX_PATTERN.matcher(S).matches() ? "YES" : "NO"); 
    }
} Main
import java.util.Scanner;
import java.util.regex.Pattern;

public class Main {
    private static final Pattern REGREX_PATTERN = Pattern.compile("(dream|dreamer|erase|eraser)*");    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        System.out.println(REGREX_PATTERN.matcher(S).matches() ? "YES" : "NO"); 
    }
}