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

public class Main {
    private static final Pattern PATTERN = Pattern.compile("^(dreamer|dream|eraser|erase)+$");
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        sc.close();
                
        boolean canMake = PATTERN.matcher(s).matches();
        System.out.println(canMake ? "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 PATTERN = Pattern.compile("^(dreamer|dream|eraser|erase)+$");
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        sc.close();
                
        boolean canMake = PATTERN.matcher(s).matches();
        System.out.println(canMake ? "YES" : "NO");
    }
    
} Main private static final Pattern PATTERN = Pattern.compile("^(dreamer|dream|eraser|erase)+$"); PATTERN Pattern.compile("^(dreamer|dream|eraser|erase)+$") Pattern.compile Pattern "^(dreamer|dream|eraser|erase)+$" public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        sc.close();
                
        boolean canMake = PATTERN.matcher(s).matches();
        System.out.println(canMake ? "YES" : "NO");
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        sc.close();
                
        boolean canMake = PATTERN.matcher(s).matches();
        System.out.println(canMake ? "YES" : "NO");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc sc.close() sc.close sc boolean canMake = PATTERN.matcher(s).matches(); canMake PATTERN.matcher(s).matches() PATTERN.matcher(s).matches PATTERN.matcher(s) PATTERN.matcher PATTERN s System.out.println(canMake ? "YES" : "NO") System.out.println System.out System System.out canMake ? "YES" : "NO" canMake "YES" "NO" String[] args args public class Main {
    private static final Pattern PATTERN = Pattern.compile("^(dreamer|dream|eraser|erase)+$");
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        sc.close();
                
        boolean canMake = PATTERN.matcher(s).matches();
        System.out.println(canMake ? "YES" : "NO");
    }
    
} public class Main {
    private static final Pattern PATTERN = Pattern.compile("^(dreamer|dream|eraser|erase)+$");
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        sc.close();
                
        boolean canMake = PATTERN.matcher(s).matches();
        System.out.println(canMake ? "YES" : "NO");
    }
    
} Main
import java.util.Scanner;
import java.util.regex.Pattern;

public class Main {
    private static final Pattern PATTERN = Pattern.compile("^(dreamer|dream|eraser|erase)+$");
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        sc.close();
                
        boolean canMake = PATTERN.matcher(s).matches();
        System.out.println(canMake ? "YES" : "NO");
    }
    
}