import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        char[][] candidate = {{'d', 'r', 'e', 'a', 'm', 'e', 'r'},
                                {'e', 'r', 'a', 's', 'e', 'r'},
                                {'d', 'r', 'e', 'a', 'm'},
                                {'e', 'r', 'a', 's', 'e'}};

        for(int i = 0;i < s.length / 2;i++) {
            char tmp = s[i];
            s[i] = s[s.length - i - 1];
            s[s.length - i - 1] = tmp;
        }

        for(int i = 0;i < 4;i++) {
            for(int j = 0;j < candidate[i].length / 2;j++) {
                char tmp = candidate[i][j];
                candidate[i][j] = candidate[i][candidate[i].length - j - 1];
                candidate[i][candidate[i].length - j - 1] = tmp;
            }
        }

        int i = 0;
        boolean isSuccess = false;
        while(true) {
            boolean isSame = false;
            for(int j = 0;j < 4;j++) {
                if(i + candidate[j].length > s.length) continue;

                isSame = true;
                for(int k = 0;k < candidate[j].length;k++) {
                    if(s[i + k] != candidate[j][k]) {
                        isSame = false;
                        break;
                    }
                }

                if(isSame) {
                    i += candidate[j].length;
                    break;
                }
            }

            if(isSame && i == s.length) {
                isSuccess = true;
                break;
            }
            else if(!isSame) {
                break;
            }
        }

        String ans = isSuccess ? "YES" : "NO";
        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        char[][] candidate = {{'d', 'r', 'e', 'a', 'm', 'e', 'r'},
                                {'e', 'r', 'a', 's', 'e', 'r'},
                                {'d', 'r', 'e', 'a', 'm'},
                                {'e', 'r', 'a', 's', 'e'}};

        for(int i = 0;i < s.length / 2;i++) {
            char tmp = s[i];
            s[i] = s[s.length - i - 1];
            s[s.length - i - 1] = tmp;
        }

        for(int i = 0;i < 4;i++) {
            for(int j = 0;j < candidate[i].length / 2;j++) {
                char tmp = candidate[i][j];
                candidate[i][j] = candidate[i][candidate[i].length - j - 1];
                candidate[i][candidate[i].length - j - 1] = tmp;
            }
        }

        int i = 0;
        boolean isSuccess = false;
        while(true) {
            boolean isSame = false;
            for(int j = 0;j < 4;j++) {
                if(i + candidate[j].length > s.length) continue;

                isSame = true;
                for(int k = 0;k < candidate[j].length;k++) {
                    if(s[i + k] != candidate[j][k]) {
                        isSame = false;
                        break;
                    }
                }

                if(isSame) {
                    i += candidate[j].length;
                    break;
                }
            }

            if(isSame && i == s.length) {
                isSuccess = true;
                break;
            }
            else if(!isSame) {
                break;
            }
        }

        String ans = isSuccess ? "YES" : "NO";
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        char[][] candidate = {{'d', 'r', 'e', 'a', 'm', 'e', 'r'},
                                {'e', 'r', 'a', 's', 'e', 'r'},
                                {'d', 'r', 'e', 'a', 'm'},
                                {'e', 'r', 'a', 's', 'e'}};

        for(int i = 0;i < s.length / 2;i++) {
            char tmp = s[i];
            s[i] = s[s.length - i - 1];
            s[s.length - i - 1] = tmp;
        }

        for(int i = 0;i < 4;i++) {
            for(int j = 0;j < candidate[i].length / 2;j++) {
                char tmp = candidate[i][j];
                candidate[i][j] = candidate[i][candidate[i].length - j - 1];
                candidate[i][candidate[i].length - j - 1] = tmp;
            }
        }

        int i = 0;
        boolean isSuccess = false;
        while(true) {
            boolean isSame = false;
            for(int j = 0;j < 4;j++) {
                if(i + candidate[j].length > s.length) continue;

                isSame = true;
                for(int k = 0;k < candidate[j].length;k++) {
                    if(s[i + k] != candidate[j][k]) {
                        isSame = false;
                        break;
                    }
                }

                if(isSame) {
                    i += candidate[j].length;
                    break;
                }
            }

            if(isSame && i == s.length) {
                isSuccess = true;
                break;
            }
            else if(!isSame) {
                break;
            }
        }

        String ans = isSuccess ? "YES" : "NO";
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        char[][] candidate = {{'d', 'r', 'e', 'a', 'm', 'e', 'r'},
                                {'e', 'r', 'a', 's', 'e', 'r'},
                                {'d', 'r', 'e', 'a', 'm'},
                                {'e', 'r', 'a', 's', 'e'}};

        for(int i = 0;i < s.length / 2;i++) {
            char tmp = s[i];
            s[i] = s[s.length - i - 1];
            s[s.length - i - 1] = tmp;
        }

        for(int i = 0;i < 4;i++) {
            for(int j = 0;j < candidate[i].length / 2;j++) {
                char tmp = candidate[i][j];
                candidate[i][j] = candidate[i][candidate[i].length - j - 1];
                candidate[i][candidate[i].length - j - 1] = tmp;
            }
        }

        int i = 0;
        boolean isSuccess = false;
        while(true) {
            boolean isSame = false;
            for(int j = 0;j < 4;j++) {
                if(i + candidate[j].length > s.length) continue;

                isSame = true;
                for(int k = 0;k < candidate[j].length;k++) {
                    if(s[i + k] != candidate[j][k]) {
                        isSame = false;
                        break;
                    }
                }

                if(isSame) {
                    i += candidate[j].length;
                    break;
                }
            }

            if(isSame && i == s.length) {
                isSuccess = true;
                break;
            }
            else if(!isSame) {
                break;
            }
        }

        String ans = isSuccess ? "YES" : "NO";
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] s = sc.next().toCharArray(); s sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc char[][] candidate = {{'d', 'r', 'e', 'a', 'm', 'e', 'r'},
                                {'e', 'r', 'a', 's', 'e', 'r'},
                                {'d', 'r', 'e', 'a', 'm'},
                                {'e', 'r', 'a', 's', 'e'}}; candidate {{'d', 'r', 'e', 'a', 'm', 'e', 'r'},
                                {'e', 'r', 'a', 's', 'e', 'r'},
                                {'d', 'r', 'e', 'a', 'm'},
                                {'e', 'r', 'a', 's', 'e'}} {'d', 'r', 'e', 'a', 'm', 'e', 'r'} 'd' 'r' 'e' 'a' 'm' 'e' 'r' {'e', 'r', 'a', 's', 'e', 'r'} 'e' 'r' 'a' 's' 'e' 'r' {'d', 'r', 'e', 'a', 'm'} 'd' 'r' 'e' 'a' 'm' {'e', 'r', 'a', 's', 'e'} 'e' 'r' 'a' 's' 'e' for(int i = 0;i < s.length / 2;i++) {
            char tmp = s[i];
            s[i] = s[s.length - i - 1];
            s[s.length - i - 1] = tmp;
        } int i = 0; int i = 0; i 0 i < s.length / 2 i s.length / 2 s.length s s.length 2 i++ i++ i {
            char tmp = s[i];
            s[i] = s[s.length - i - 1];
            s[s.length - i - 1] = tmp;
        } {
            char tmp = s[i];
            s[i] = s[s.length - i - 1];
            s[s.length - i - 1] = tmp;
        } char tmp = s[i]; tmp s[i] s i s[i] = s[s.length - i - 1] s[i] s i s[s.length - i - 1] s s.length - i - 1 s.length - i - 1 s.length s s.length i 1 s[s.length - i - 1] = tmp s[s.length - i - 1] s s.length - i - 1 s.length - i - 1 s.length s s.length i 1 tmp for(int i = 0;i < 4;i++) {
            for(int j = 0;j < candidate[i].length / 2;j++) {
                char tmp = candidate[i][j];
                candidate[i][j] = candidate[i][candidate[i].length - j - 1];
                candidate[i][candidate[i].length - j - 1] = tmp;
            }
        } int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
            for(int j = 0;j < candidate[i].length / 2;j++) {
                char tmp = candidate[i][j];
                candidate[i][j] = candidate[i][candidate[i].length - j - 1];
                candidate[i][candidate[i].length - j - 1] = tmp;
            }
        } {
            for(int j = 0;j < candidate[i].length / 2;j++) {
                char tmp = candidate[i][j];
                candidate[i][j] = candidate[i][candidate[i].length - j - 1];
                candidate[i][candidate[i].length - j - 1] = tmp;
            }
        } for(int j = 0;j < candidate[i].length / 2;j++) {
                char tmp = candidate[i][j];
                candidate[i][j] = candidate[i][candidate[i].length - j - 1];
                candidate[i][candidate[i].length - j - 1] = tmp;
            } int j = 0; int j = 0; j 0 j < candidate[i].length / 2 j candidate[i].length / 2 candidate[i].length candidate[i] candidate i candidate[i].length 2 j++ j++ j {
                char tmp = candidate[i][j];
                candidate[i][j] = candidate[i][candidate[i].length - j - 1];
                candidate[i][candidate[i].length - j - 1] = tmp;
            } {
                char tmp = candidate[i][j];
                candidate[i][j] = candidate[i][candidate[i].length - j - 1];
                candidate[i][candidate[i].length - j - 1] = tmp;
            } char tmp = candidate[i][j]; tmp candidate[i][j] candidate[i] candidate i j candidate[i][j] = candidate[i][candidate[i].length - j - 1] candidate[i][j] candidate[i] candidate i j candidate[i][candidate[i].length - j - 1] candidate[i] candidate i candidate[i].length - j - 1 candidate[i].length - j - 1 candidate[i].length candidate[i] candidate i candidate[i].length j 1 candidate[i][candidate[i].length - j - 1] = tmp candidate[i][candidate[i].length - j - 1] candidate[i] candidate i candidate[i].length - j - 1 candidate[i].length - j - 1 candidate[i].length candidate[i] candidate i candidate[i].length j 1 tmp int i = 0; i 0 boolean isSuccess = false; isSuccess false while(true) {
            boolean isSame = false;
            for(int j = 0;j < 4;j++) {
                if(i + candidate[j].length > s.length) continue;

                isSame = true;
                for(int k = 0;k < candidate[j].length;k++) {
                    if(s[i + k] != candidate[j][k]) {
                        isSame = false;
                        break;
                    }
                }

                if(isSame) {
                    i += candidate[j].length;
                    break;
                }
            }

            if(isSame && i == s.length) {
                isSuccess = true;
                break;
            }
            else if(!isSame) {
                break;
            }
        } true {
            boolean isSame = false;
            for(int j = 0;j < 4;j++) {
                if(i + candidate[j].length > s.length) continue;

                isSame = true;
                for(int k = 0;k < candidate[j].length;k++) {
                    if(s[i + k] != candidate[j][k]) {
                        isSame = false;
                        break;
                    }
                }

                if(isSame) {
                    i += candidate[j].length;
                    break;
                }
            }

            if(isSame && i == s.length) {
                isSuccess = true;
                break;
            }
            else if(!isSame) {
                break;
            }
        } boolean isSame = false; isSame false for(int j = 0;j < 4;j++) {
                if(i + candidate[j].length > s.length) continue;

                isSame = true;
                for(int k = 0;k < candidate[j].length;k++) {
                    if(s[i + k] != candidate[j][k]) {
                        isSame = false;
                        break;
                    }
                }

                if(isSame) {
                    i += candidate[j].length;
                    break;
                }
            } int j = 0; int j = 0; j 0 j < 4 j 4 j++ j++ j {
                if(i + candidate[j].length > s.length) continue;

                isSame = true;
                for(int k = 0;k < candidate[j].length;k++) {
                    if(s[i + k] != candidate[j][k]) {
                        isSame = false;
                        break;
                    }
                }

                if(isSame) {
                    i += candidate[j].length;
                    break;
                }
            } {
                if(i + candidate[j].length > s.length) continue;

                isSame = true;
                for(int k = 0;k < candidate[j].length;k++) {
                    if(s[i + k] != candidate[j][k]) {
                        isSame = false;
                        break;
                    }
                }

                if(isSame) {
                    i += candidate[j].length;
                    break;
                }
            } if(i + candidate[j].length > s.length) continue; i + candidate[j].length > s.length i + candidate[j].length i candidate[j].length candidate[j] candidate j candidate[j].length s.length s s.length continue; isSame = true isSame true for(int k = 0;k < candidate[j].length;k++) {
                    if(s[i + k] != candidate[j][k]) {
                        isSame = false;
                        break;
                    }
                } int k = 0; int k = 0; k 0 k < candidate[j].length k candidate[j].length candidate[j] candidate j candidate[j].length k++ k++ k {
                    if(s[i + k] != candidate[j][k]) {
                        isSame = false;
                        break;
                    }
                } {
                    if(s[i + k] != candidate[j][k]) {
                        isSame = false;
                        break;
                    }
                } if(s[i + k] != candidate[j][k]) {
                        isSame = false;
                        break;
                    } s[i + k] != candidate[j][k] s[i + k] s i + k i k candidate[j][k] candidate[j] candidate j k {
                        isSame = false;
                        break;
                    } isSame = false isSame false break; if(isSame) {
                    i += candidate[j].length;
                    break;
                } isSame {
                    i += candidate[j].length;
                    break;
                } i += candidate[j].length i candidate[j].length candidate[j] candidate j candidate[j].length break; if(isSame && i == s.length) {
                isSuccess = true;
                break;
            }
            else if(!isSame) {
                break;
            } isSame && i == s.length isSame i == s.length i s.length s s.length {
                isSuccess = true;
                break;
            } isSuccess = true isSuccess true break; if(!isSame) {
                break;
            } !isSame isSame {
                break;
            } break; String ans = isSuccess ? "YES" : "NO"; ans isSuccess ? "YES" : "NO" isSuccess "YES" "NO" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        char[][] candidate = {{'d', 'r', 'e', 'a', 'm', 'e', 'r'},
                                {'e', 'r', 'a', 's', 'e', 'r'},
                                {'d', 'r', 'e', 'a', 'm'},
                                {'e', 'r', 'a', 's', 'e'}};

        for(int i = 0;i < s.length / 2;i++) {
            char tmp = s[i];
            s[i] = s[s.length - i - 1];
            s[s.length - i - 1] = tmp;
        }

        for(int i = 0;i < 4;i++) {
            for(int j = 0;j < candidate[i].length / 2;j++) {
                char tmp = candidate[i][j];
                candidate[i][j] = candidate[i][candidate[i].length - j - 1];
                candidate[i][candidate[i].length - j - 1] = tmp;
            }
        }

        int i = 0;
        boolean isSuccess = false;
        while(true) {
            boolean isSame = false;
            for(int j = 0;j < 4;j++) {
                if(i + candidate[j].length > s.length) continue;

                isSame = true;
                for(int k = 0;k < candidate[j].length;k++) {
                    if(s[i + k] != candidate[j][k]) {
                        isSame = false;
                        break;
                    }
                }

                if(isSame) {
                    i += candidate[j].length;
                    break;
                }
            }

            if(isSame && i == s.length) {
                isSuccess = true;
                break;
            }
            else if(!isSame) {
                break;
            }
        }

        String ans = isSuccess ? "YES" : "NO";
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        char[][] candidate = {{'d', 'r', 'e', 'a', 'm', 'e', 'r'},
                                {'e', 'r', 'a', 's', 'e', 'r'},
                                {'d', 'r', 'e', 'a', 'm'},
                                {'e', 'r', 'a', 's', 'e'}};

        for(int i = 0;i < s.length / 2;i++) {
            char tmp = s[i];
            s[i] = s[s.length - i - 1];
            s[s.length - i - 1] = tmp;
        }

        for(int i = 0;i < 4;i++) {
            for(int j = 0;j < candidate[i].length / 2;j++) {
                char tmp = candidate[i][j];
                candidate[i][j] = candidate[i][candidate[i].length - j - 1];
                candidate[i][candidate[i].length - j - 1] = tmp;
            }
        }

        int i = 0;
        boolean isSuccess = false;
        while(true) {
            boolean isSame = false;
            for(int j = 0;j < 4;j++) {
                if(i + candidate[j].length > s.length) continue;

                isSame = true;
                for(int k = 0;k < candidate[j].length;k++) {
                    if(s[i + k] != candidate[j][k]) {
                        isSame = false;
                        break;
                    }
                }

                if(isSame) {
                    i += candidate[j].length;
                    break;
                }
            }

            if(isSame && i == s.length) {
                isSuccess = true;
                break;
            }
            else if(!isSame) {
                break;
            }
        }

        String ans = isSuccess ? "YES" : "NO";
        System.out.println(ans);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        char[][] candidate = {{'d', 'r', 'e', 'a', 'm', 'e', 'r'},
                                {'e', 'r', 'a', 's', 'e', 'r'},
                                {'d', 'r', 'e', 'a', 'm'},
                                {'e', 'r', 'a', 's', 'e'}};

        for(int i = 0;i < s.length / 2;i++) {
            char tmp = s[i];
            s[i] = s[s.length - i - 1];
            s[s.length - i - 1] = tmp;
        }

        for(int i = 0;i < 4;i++) {
            for(int j = 0;j < candidate[i].length / 2;j++) {
                char tmp = candidate[i][j];
                candidate[i][j] = candidate[i][candidate[i].length - j - 1];
                candidate[i][candidate[i].length - j - 1] = tmp;
            }
        }

        int i = 0;
        boolean isSuccess = false;
        while(true) {
            boolean isSame = false;
            for(int j = 0;j < 4;j++) {
                if(i + candidate[j].length > s.length) continue;

                isSame = true;
                for(int k = 0;k < candidate[j].length;k++) {
                    if(s[i + k] != candidate[j][k]) {
                        isSame = false;
                        break;
                    }
                }

                if(isSame) {
                    i += candidate[j].length;
                    break;
                }
            }

            if(isSame && i == s.length) {
                isSuccess = true;
                break;
            }
            else if(!isSame) {
                break;
            }
        }

        String ans = isSuccess ? "YES" : "NO";
        System.out.println(ans);
    }
}