import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        // str = reverse(str);
        // System.out.println(str.substring(6, 11));
        String[] divide = new String[]{"dream", "dreamer", "erase", "eraser"};
        for(int i=0;i<4;i++){
            divide[i] = reverse(divide[i]);
        }
        str = reverse(str);
        boolean can = true;
        for(int i=0;i<str.length();){
            boolean can2 = false;
            for(int j=0;j<4;j++){
                String d = divide[j];
                try {
                    if(str.substring(i, i+d.length()).equalsIgnoreCase(d)){
                        can2 = true;
                        i += d.length();
                    }
                } catch (StringIndexOutOfBoundsException e) {
                    continue;
                }
                
            }
            if(!can2){
                can = false;
                break;
            }
        }
        if(can){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
    public static String reverse(String arg){
        char[] chStr = arg.toCharArray();
        StringBuilder builder = new StringBuilder();
        for(int i=chStr.length; i>0; i--){
            builder.append(chStr[i-1]);
        }
        return builder.toString();
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        // str = reverse(str);
        // System.out.println(str.substring(6, 11));
        String[] divide = new String[]{"dream", "dreamer", "erase", "eraser"};
        for(int i=0;i<4;i++){
            divide[i] = reverse(divide[i]);
        }
        str = reverse(str);
        boolean can = true;
        for(int i=0;i<str.length();){
            boolean can2 = false;
            for(int j=0;j<4;j++){
                String d = divide[j];
                try {
                    if(str.substring(i, i+d.length()).equalsIgnoreCase(d)){
                        can2 = true;
                        i += d.length();
                    }
                } catch (StringIndexOutOfBoundsException e) {
                    continue;
                }
                
            }
            if(!can2){
                can = false;
                break;
            }
        }
        if(can){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
    public static String reverse(String arg){
        char[] chStr = arg.toCharArray();
        StringBuilder builder = new StringBuilder();
        for(int i=chStr.length; i>0; i--){
            builder.append(chStr[i-1]);
        }
        return builder.toString();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        // str = reverse(str);
        // System.out.println(str.substring(6, 11));
        String[] divide = new String[]{"dream", "dreamer", "erase", "eraser"};
        for(int i=0;i<4;i++){
            divide[i] = reverse(divide[i]);
        }
        str = reverse(str);
        boolean can = true;
        for(int i=0;i<str.length();){
            boolean can2 = false;
            for(int j=0;j<4;j++){
                String d = divide[j];
                try {
                    if(str.substring(i, i+d.length()).equalsIgnoreCase(d)){
                        can2 = true;
                        i += d.length();
                    }
                } catch (StringIndexOutOfBoundsException e) {
                    continue;
                }
                
            }
            if(!can2){
                can = false;
                break;
            }
        }
        if(can){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        // str = reverse(str);
        // System.out.println(str.substring(6, 11));
        String[] divide = new String[]{"dream", "dreamer", "erase", "eraser"};
        for(int i=0;i<4;i++){
            divide[i] = reverse(divide[i]);
        }
        str = reverse(str);
        boolean can = true;
        for(int i=0;i<str.length();){
            boolean can2 = false;
            for(int j=0;j<4;j++){
                String d = divide[j];
                try {
                    if(str.substring(i, i+d.length()).equalsIgnoreCase(d)){
                        can2 = true;
                        i += d.length();
                    }
                } catch (StringIndexOutOfBoundsException e) {
                    continue;
                }
                
            }
            if(!can2){
                can = false;
                break;
            }
        }
        if(can){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.next(); str sc.next() sc.next sc String[] divide = new String[]{"dream", "dreamer", "erase", "eraser"}; divide new String[]{"dream", "dreamer", "erase", "eraser"} for(int i=0;i<4;i++){
            divide[i] = reverse(divide[i]);
        } int i=0; int i=0; i 0 i<4 i 4 i++ i++ i {
            divide[i] = reverse(divide[i]);
        } {
            divide[i] = reverse(divide[i]);
        } divide[i] = reverse(divide[i]) divide[i] divide i reverse(divide[i]) reverse divide[i] divide i str = reverse(str) str reverse(str) reverse str boolean can = true; can true for(int i=0;i<str.length();){
            boolean can2 = false;
            for(int j=0;j<4;j++){
                String d = divide[j];
                try {
                    if(str.substring(i, i+d.length()).equalsIgnoreCase(d)){
                        can2 = true;
                        i += d.length();
                    }
                } catch (StringIndexOutOfBoundsException e) {
                    continue;
                }
                
            }
            if(!can2){
                can = false;
                break;
            }
        } int i=0; int i=0; i 0 i<str.length() i str.length() str.length str {
            boolean can2 = false;
            for(int j=0;j<4;j++){
                String d = divide[j];
                try {
                    if(str.substring(i, i+d.length()).equalsIgnoreCase(d)){
                        can2 = true;
                        i += d.length();
                    }
                } catch (StringIndexOutOfBoundsException e) {
                    continue;
                }
                
            }
            if(!can2){
                can = false;
                break;
            }
        } {
            boolean can2 = false;
            for(int j=0;j<4;j++){
                String d = divide[j];
                try {
                    if(str.substring(i, i+d.length()).equalsIgnoreCase(d)){
                        can2 = true;
                        i += d.length();
                    }
                } catch (StringIndexOutOfBoundsException e) {
                    continue;
                }
                
            }
            if(!can2){
                can = false;
                break;
            }
        } boolean can2 = false; can2 false for(int j=0;j<4;j++){
                String d = divide[j];
                try {
                    if(str.substring(i, i+d.length()).equalsIgnoreCase(d)){
                        can2 = true;
                        i += d.length();
                    }
                } catch (StringIndexOutOfBoundsException e) {
                    continue;
                }
                
            } int j=0; int j=0; j 0 j<4 j 4 j++ j++ j {
                String d = divide[j];
                try {
                    if(str.substring(i, i+d.length()).equalsIgnoreCase(d)){
                        can2 = true;
                        i += d.length();
                    }
                } catch (StringIndexOutOfBoundsException e) {
                    continue;
                }
                
            } {
                String d = divide[j];
                try {
                    if(str.substring(i, i+d.length()).equalsIgnoreCase(d)){
                        can2 = true;
                        i += d.length();
                    }
                } catch (StringIndexOutOfBoundsException e) {
                    continue;
                }
                
            } String d = divide[j]; d divide[j] divide j try {
                    if(str.substring(i, i+d.length()).equalsIgnoreCase(d)){
                        can2 = true;
                        i += d.length();
                    }
                } catch (StringIndexOutOfBoundsException e) {
                    continue;
                } catch (StringIndexOutOfBoundsException e) {
                    continue;
                } StringIndexOutOfBoundsException e {
                    continue;
                } continue; {
                    if(str.substring(i, i+d.length()).equalsIgnoreCase(d)){
                        can2 = true;
                        i += d.length();
                    }
                } if(str.substring(i, i+d.length()).equalsIgnoreCase(d)){
                        can2 = true;
                        i += d.length();
                    } str.substring(i, i+d.length()).equalsIgnoreCase(d) str.substring(i, i+d.length()).equalsIgnoreCase str.substring(i, i+d.length()) str.substring str i i+d.length() i d.length() d.length d d {
                        can2 = true;
                        i += d.length();
                    } can2 = true can2 true i += d.length() i d.length() d.length d if(!can2){
                can = false;
                break;
            } !can2 can2 {
                can = false;
                break;
            } can = false can false break; if(can){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        } can {
            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 static String reverse(String arg){
        char[] chStr = arg.toCharArray();
        StringBuilder builder = new StringBuilder();
        for(int i=chStr.length; i>0; i--){
            builder.append(chStr[i-1]);
        }
        return builder.toString();
    } reverse {
        char[] chStr = arg.toCharArray();
        StringBuilder builder = new StringBuilder();
        for(int i=chStr.length; i>0; i--){
            builder.append(chStr[i-1]);
        }
        return builder.toString();
    } char[] chStr = arg.toCharArray(); chStr arg.toCharArray() arg.toCharArray arg StringBuilder builder = new StringBuilder(); builder new StringBuilder() for(int i=chStr.length; i>0; i--){
            builder.append(chStr[i-1]);
        } int i=chStr.length; int i=chStr.length; i chStr.length chStr chStr.length i>0 i 0 i-- i-- i {
            builder.append(chStr[i-1]);
        } {
            builder.append(chStr[i-1]);
        } builder.append(chStr[i-1]) builder.append builder chStr[i-1] chStr i-1 i 1 return builder.toString(); builder.toString() builder.toString builder String arg arg public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        // str = reverse(str);
        // System.out.println(str.substring(6, 11));
        String[] divide = new String[]{"dream", "dreamer", "erase", "eraser"};
        for(int i=0;i<4;i++){
            divide[i] = reverse(divide[i]);
        }
        str = reverse(str);
        boolean can = true;
        for(int i=0;i<str.length();){
            boolean can2 = false;
            for(int j=0;j<4;j++){
                String d = divide[j];
                try {
                    if(str.substring(i, i+d.length()).equalsIgnoreCase(d)){
                        can2 = true;
                        i += d.length();
                    }
                } catch (StringIndexOutOfBoundsException e) {
                    continue;
                }
                
            }
            if(!can2){
                can = false;
                break;
            }
        }
        if(can){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
    public static String reverse(String arg){
        char[] chStr = arg.toCharArray();
        StringBuilder builder = new StringBuilder();
        for(int i=chStr.length; i>0; i--){
            builder.append(chStr[i-1]);
        }
        return builder.toString();
    }
} public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        // str = reverse(str);
        // System.out.println(str.substring(6, 11));
        String[] divide = new String[]{"dream", "dreamer", "erase", "eraser"};
        for(int i=0;i<4;i++){
            divide[i] = reverse(divide[i]);
        }
        str = reverse(str);
        boolean can = true;
        for(int i=0;i<str.length();){
            boolean can2 = false;
            for(int j=0;j<4;j++){
                String d = divide[j];
                try {
                    if(str.substring(i, i+d.length()).equalsIgnoreCase(d)){
                        can2 = true;
                        i += d.length();
                    }
                } catch (StringIndexOutOfBoundsException e) {
                    continue;
                }
                
            }
            if(!can2){
                can = false;
                break;
            }
        }
        if(can){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
    public static String reverse(String arg){
        char[] chStr = arg.toCharArray();
        StringBuilder builder = new StringBuilder();
        for(int i=chStr.length; i>0; i--){
            builder.append(chStr[i-1]);
        }
        return builder.toString();
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        // str = reverse(str);
        // System.out.println(str.substring(6, 11));
        String[] divide = new String[]{"dream", "dreamer", "erase", "eraser"};
        for(int i=0;i<4;i++){
            divide[i] = reverse(divide[i]);
        }
        str = reverse(str);
        boolean can = true;
        for(int i=0;i<str.length();){
            boolean can2 = false;
            for(int j=0;j<4;j++){
                String d = divide[j];
                try {
                    if(str.substring(i, i+d.length()).equalsIgnoreCase(d)){
                        can2 = true;
                        i += d.length();
                    }
                } catch (StringIndexOutOfBoundsException e) {
                    continue;
                }
                
            }
            if(!can2){
                can = false;
                break;
            }
        }
        if(can){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
    public static String reverse(String arg){
        char[] chStr = arg.toCharArray();
        StringBuilder builder = new StringBuilder();
        for(int i=chStr.length; i>0; i--){
            builder.append(chStr[i-1]);
        }
        return builder.toString();
    }
}