#import <Foundation/Foundation.h>
#import <stdarg.h>

@interface StdIO : NSObject
+(NSMutableString*)stringFromStdIn; // 標準入力から NSString を得る
+(void)printf:(NSString*)format, ...; // 標準出力へ出力
@end

@implementation StdIO
+(NSMutableString*)stringFromStdIn
{
    NSFileHandle *handle = [NSFileHandle fileHandleWithStandardInput];
    NSMutableString *result = [NSMutableString string];
    NSData *data = [handle availableData];
    while ([data length] > 0) {
        [result appendString:[[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease]];
        data = [handle availableData];
    }
    NSUInteger lastIndex = [result length] - 1;
    if (lastIndex >= 0 && [result characterAtIndex:lastIndex] == '\n') { // 入力末尾に改行文字があれば削除
        [result deleteCharactersInRange:NSMakeRange(lastIndex,1)];
    }
    return result;
}
+(void)printf:(NSString*)format, ...
{
    va_list arguments;
    va_start(arguments, format);
    NSString *string = [[[NSString alloc] initWithFormat:format arguments:arguments] autorelease];
    NSFileHandle *fileHandle = [NSFileHandle fileHandleWithStandardOutput];
    [fileHandle writeData:[string dataUsingEncoding:NSUTF8StringEncoding]];
    va_end(arguments);
}
@end
 

@interface NSMutableArray (Extension)
-(id)shift;
@end

@implementation NSMutableArray (Extension)
-(id)shift
{
    if ([self count] > 0) {
        id first = [self objectAtIndex: 0];
        [self removeObjectAtIndex: 0];
        return first;
    } else {
        return nil;
    }
}
@end

int main() {
    @autoreleasepool {
        NSString *S = [StdIO stringFromStdIn];
        NSUInteger length = [S length];
        NSMutableArray *candidates = [NSMutableArray arrayWithObject:@0]; // 切断に成功している位置の候補を格納するキュー
        NSNumber *candidate;
        while ((candidate = [candidates shift])) {
            NSUInteger currentIndex = [candidate unsignedIntegerValue]; // 先頭候補を取り出し
            if (currentIndex+5 <= length) {
                NSString *prefix5 = [S substringWithRange:NSMakeRange(currentIndex, 5)];
                if ([prefix5 isEqualToString:@"dream"] || [prefix5 isEqualToString:@"erase"]) {
                    if (currentIndex == length-5) {
                        [StdIO printf:@"YES"];
                        return 0;
                    }
                    [candidates addObject:@(currentIndex+5)];
                }
            }
            if (currentIndex+6 <= length) {
                NSString *prefix6 = [S substringWithRange:NSMakeRange(currentIndex, 6)];
                if ([prefix6 isEqualToString:@"eraser"]) {
                    if (currentIndex == length-6) {
                        [StdIO printf:@"YES"];
                        return 0;
                    }
                    [candidates addObject:@(currentIndex+6)];
                }
            }
            if (currentIndex+7 <= length) {
                NSString *prefix7 = [S substringWithRange:NSMakeRange(currentIndex, 7)];
                if ([prefix7 isEqualToString:@"dreamer"]) {
                    if (currentIndex == length-7) {
                        [StdIO printf:@"YES"];
                        return 0;
                    }
                    [candidates addObject:@(currentIndex+7)];
                }
            }
        }
        [StdIO printf:@"NO"];
    }
    return 0;
}
