import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String s=sc.next();
s=s.replaceAll("eraser", "-");
s=s.replaceAll("erase", "-");
s=s.replaceAll("dreamer", "-");
s=s.replaceAll("dream", "-");
s=s.replaceAll("-","");
if(s.equals("")){System.out.println("YES");}else{System.out.println("NO");}
}} import java.util.*; util.* java public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String s=sc.next();
s=s.replaceAll("eraser", "-");
s=s.replaceAll("erase", "-");
s=s.replaceAll("dreamer", "-");
s=s.replaceAll("dream", "-");
s=s.replaceAll("-","");
if(s.equals("")){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();
s=s.replaceAll("eraser", "-");
s=s.replaceAll("erase", "-");
s=s.replaceAll("dreamer", "-");
s=s.replaceAll("dream", "-");
s=s.replaceAll("-","");
if(s.equals("")){System.out.println("YES");}else{System.out.println("NO");}
} main {
Scanner sc = new Scanner(System.in);
String s=sc.next();
s=s.replaceAll("eraser", "-");
s=s.replaceAll("erase", "-");
s=s.replaceAll("dreamer", "-");
s=s.replaceAll("dream", "-");
s=s.replaceAll("-","");
if(s.equals("")){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 s=s.replaceAll("eraser", "-") s s.replaceAll("eraser", "-") s.replaceAll s "eraser" "-" s=s.replaceAll("erase", "-") s s.replaceAll("erase", "-") s.replaceAll s "erase" "-" s=s.replaceAll("dreamer", "-") s s.replaceAll("dreamer", "-") s.replaceAll s "dreamer" "-" s=s.replaceAll("dream", "-") s s.replaceAll("dream", "-") s.replaceAll s "dream" "-" s=s.replaceAll("-","") s s.replaceAll("-","") s.replaceAll s "-" "" if(s.equals("")){System.out.println("YES");}else{System.out.println("NO");} s.equals("") s.equals s "" {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 public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String s=sc.next();
s=s.replaceAll("eraser", "-");
s=s.replaceAll("erase", "-");
s=s.replaceAll("dreamer", "-");
s=s.replaceAll("dream", "-");
s=s.replaceAll("-","");
if(s.equals("")){System.out.println("YES");}else{System.out.println("NO");}
}} public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String s=sc.next();
s=s.replaceAll("eraser", "-");
s=s.replaceAll("erase", "-");
s=s.replaceAll("dreamer", "-");
s=s.replaceAll("dream", "-");
s=s.replaceAll("-","");
if(s.equals("")){System.out.println("YES");}else{System.out.println("NO");}
}} Main
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String s=sc.next();
s=s.replaceAll("eraser", "-");
s=s.replaceAll("erase", "-");
s=s.replaceAll("dreamer", "-");
s=s.replaceAll("dream", "-");
s=s.replaceAll("-","");
if(s.equals("")){System.out.println("YES");}else{System.out.println("NO");}
}}