Buggy python submission (verdict: Runtime Error):
def checkcheck(s):
    if s=="":
        return True
    else:
        if len(s)>=7:
            if s[-5:]=="dream" or s[-5:]=="erase":
                    s=s[:-5]
                    return checkcheck(s)
            elif s[-7:]=="dreamer":
                    s=s[:-7]
                    return checkcheck(s)
            
            elif s[-6:]=="eraser":
                    s=s[:-6]
                    return checkcheck(s) 
            else:
                s="WOW"
                return False


                
        elif len(s)==6:
            if s[-6:]=="eraser":
                return True
            else:
                return False
            
        elif len(s)==5:
            if s[-5:]=="dream" or s[-5:]=="erase":
                return True
            else:
                return False
        else:
            return False
  
s=input()
if checkcheck(s)==True:
    print("YES")
elif checkcheck(s)==False:
    print("NO")

    

Fixed submission:
s=input()
length=len(s)

s=s[::-1]

s=s+"WWWWWWW"

index=0
flag=True
while index<length:
    if s[index]=="m" and s[index+1]=="a" and s[index+2]=="e" and s[index+3]=="r" and s[index+4]=="d":
        index+=5
    elif s[index]=="e" and s[index+1]=="s" and s[index+2]=="a" and s[index+3]=="r" and s[index+4]=="e":
        index+=5   
    elif s[index]=="r" and s[index+1]=="e" and s[index+2]=="m" and s[index+3]=="a" and s[index+4]=="e" and s[index+5]=="r" and s[index+6]=="d":
        index+=7   
    elif s[index]=="r" and s[index+1]=="e" and s[index+2]=="s" and s[index+3]=="a" and s[index+4]=="r" and s[index+5]=="e":
        index+=6
    else:
        flag=False
        break
if flag:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
def check(s):
    if s=="":
        return True
    else:
        if len(s)>=7:
            if s[-5:]=="dream" or s[-5:]=="erase":
                    s=s[:-5]
                    print(s)
                    return check(s)
                
            elif s[-7:]=="dreamer":
                    s=s[:-7]
                    print(s)
                    return check(s)
            
            elif s[-6:]=="eraser":
                    s=s[:-6]
                    print(s)
                    return check(s) 
            else:
              return False


                
        elif len(s)==6:
            if s[-6:]=="eraser":
                return True
            
            else:
                return False

            
        elif len(s)==5:
            if s[-5:]=="dream" or s[-5:]=="erase":
                return True
            else:
                return False

        else:
            return False
  
s=input()
if check(s):
    print("Yes")
else:
    print("No")

Fixed submission:
s=input()
length=len(s)

s=s[::-1]

s=s+"WWWWWWW"

index=0
flag=True
while index<length:
    if s[index]=="m" and s[index+1]=="a" and s[index+2]=="e" and s[index+3]=="r" and s[index+4]=="d":
        index+=5
    elif s[index]=="e" and s[index+1]=="s" and s[index+2]=="a" and s[index+3]=="r" and s[index+4]=="e":
        index+=5   
    elif s[index]=="r" and s[index+1]=="e" and s[index+2]=="m" and s[index+3]=="a" and s[index+4]=="e" and s[index+5]=="r" and s[index+6]=="d":
        index+=7   
    elif s[index]=="r" and s[index+1]=="e" and s[index+2]=="s" and s[index+3]=="a" and s[index+4]=="r" and s[index+5]=="e":
        index+=6
    else:
        flag=False
        break
if flag:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
s=input()
def check(s):
    if s=="":
        return True
    else:
        if len(s)>=7:
            if s[-5:]=="dream" or s[-5:]=="erase":
                    s=s[:-5]
                    return check(s)
                
            elif s[-7:]=="dreamer":
                    s=s[:-7]
                    return check(s)
                
            elif s[-6:]=="eraser":
                    s=s[:-6]
                    return check(s) 
                
                
        elif len(s)==6:
            if s[-6:]=="eraser":
                return True
            
            else:
                return False
            
        elif len(s)==5:
            if s[-5:]=="dream" or s[-5:]=="erase":
                return True
            
            else:
                return False
            
        else:
            return False
        
if check(s):
    print("Yes")
else:
    print("No")


Fixed submission:
s=input()
length=len(s)

s=s[::-1]

s=s+"WWWWWWW"

index=0
flag=True
while index<length:
    if s[index]=="m" and s[index+1]=="a" and s[index+2]=="e" and s[index+3]=="r" and s[index+4]=="d":
        index+=5
    elif s[index]=="e" and s[index+1]=="s" and s[index+2]=="a" and s[index+3]=="r" and s[index+4]=="e":
        index+=5   
    elif s[index]=="r" and s[index+1]=="e" and s[index+2]=="m" and s[index+3]=="a" and s[index+4]=="e" and s[index+5]=="r" and s[index+6]=="d":
        index+=7   
    elif s[index]=="r" and s[index+1]=="e" and s[index+2]=="s" and s[index+3]=="a" and s[index+4]=="r" and s[index+5]=="e":
        index+=6
    else:
        flag=False
        break
if flag:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
s=input()
def check(s):
    if s=="":
        return True
    else:
        if len(s)>=7:
            if s[-5:]=="dream" or s[-5:]=="erase":
                    return check(s[:-5])
                
            elif s[-7:]=="dreamer":
                    return check(s[:-7])
                
            elif s[-6:]=="eraser":
                    return check(s[:-6]) 
                
                
        elif len(s)==6:
            if s[-6:]=="eraser":
                return True
            
            else:
                return False
            
        elif len(s)==5:
            if s[-5:]=="dream" or s[-5:]=="erase":
                return True
            
            else:
                return False
            
        else:
            return False
        
if check(s):
    print("Yes")
else:
    print("No")


Fixed submission:
s=input()
length=len(s)

s=s[::-1]

s=s+"WWWWWWW"

index=0
flag=True
while index<length:
    if s[index]=="m" and s[index+1]=="a" and s[index+2]=="e" and s[index+3]=="r" and s[index+4]=="d":
        index+=5
    elif s[index]=="e" and s[index+1]=="s" and s[index+2]=="a" and s[index+3]=="r" and s[index+4]=="e":
        index+=5   
    elif s[index]=="r" and s[index+1]=="e" and s[index+2]=="m" and s[index+3]=="a" and s[index+4]=="e" and s[index+5]=="r" and s[index+6]=="d":
        index+=7   
    elif s[index]=="r" and s[index+1]=="e" and s[index+2]=="s" and s[index+3]=="a" and s[index+4]=="r" and s[index+5]=="e":
        index+=6
    else:
        flag=False
        break
if flag:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
s=input()
def check(s):
    if s=="":
        return True
    else:
        if len(s)>=7:
        	if s[-5:]=="dream" or s[-5:]=="erase":
                    return check(s[:-5])
                
            elif s[-7:]=="dreamer":
                    return check(s[:-7])
                
            elif s[-6:]=="eraser":
                    return check(s[:-6]) 
                
                
        elif len(s)==6:
            if s[-6:]=="eraser":
                return True
            
            else:
                return False
            
        elif len(s)==5:
            if s[-5:]=="dream" or s[-5:]=="erase":
                return True
            
            else:
                return False
            
        else:
            return False
        
if check(s):
    print("Yes")
else:
    print("No")


Fixed submission:
s=input()
length=len(s)

s=s[::-1]

s=s+"WWWWWWW"

index=0
flag=True
while index<length:
    if s[index]=="m" and s[index+1]=="a" and s[index+2]=="e" and s[index+3]=="r" and s[index+4]=="d":
        index+=5
    elif s[index]=="e" and s[index+1]=="s" and s[index+2]=="a" and s[index+3]=="r" and s[index+4]=="e":
        index+=5   
    elif s[index]=="r" and s[index+1]=="e" and s[index+2]=="m" and s[index+3]=="a" and s[index+4]=="e" and s[index+5]=="r" and s[index+6]=="d":
        index+=7   
    elif s[index]=="r" and s[index+1]=="e" and s[index+2]=="s" and s[index+3]=="a" and s[index+4]=="r" and s[index+5]=="e":
        index+=6
    else:
        flag=False
        break
if flag:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
s=input()
def check(s):
    if s=="":
        return True
    else:
        if len(s)>=7:
             if s[-5:]=="dream" or s[-5:]=="erase":
                    return check(s[:-5])
             elif s[-7:]=="dreamer":
                    return check(s[:-7])
             elif s[-6:]=="eraser":
                    return check(s[:-6]) 
                
        elif len(s)==6:
            if s[-6:]=="eraser":
                return True
        elif len(s)==5:
            if s[-5:]=="dream" or s[-5:]=="erase":
                return True
        else:
            return False

if check(s):
    print("Yes")
else:
    print("No")

        


Fixed submission:
s=input()
length=len(s)

s=s[::-1]

s=s+"WWWWWWW"

index=0
flag=True
while index<length:
    if s[index]=="m" and s[index+1]=="a" and s[index+2]=="e" and s[index+3]=="r" and s[index+4]=="d":
        index+=5
    elif s[index]=="e" and s[index+1]=="s" and s[index+2]=="a" and s[index+3]=="r" and s[index+4]=="e":
        index+=5   
    elif s[index]=="r" and s[index+1]=="e" and s[index+2]=="m" and s[index+3]=="a" and s[index+4]=="e" and s[index+5]=="r" and s[index+6]=="d":
        index+=7   
    elif s[index]=="r" and s[index+1]=="e" and s[index+2]=="s" and s[index+3]=="a" and s[index+4]=="r" and s[index+5]=="e":
        index+=6
    else:
        flag=False
        break
if flag:
    print("YES")
else:
    print("NO")