Problem p03854 (python)

Fixed submission:
s=input().replace("eraser",",").replace("erase",",").replace("dreamer",",").replace("dream",",").replace(",","")
print("YES" if s=="" else "NO")

Buggy submission (verdict: Runtime Error):
def dfs(n):
        divide=["dream","dreamer","erase","eraser"]
        if n==len(s):
                return True
        for i in divide:
                if n+len(i)<=len(s):
                        if s[n:n+len(i)]==i:
                                if dfs(n+len(i)):
                                        return True

        return False
s=input()
print("YES") if dfs(0) else print("NO")

Buggy submission (verdict: Runtime Error):
def dfs(n):
        divide=["dream","erase","eraser","dreamer"]
        if n==len(s):
                return True
        for i in divide:
                if n+len(i)<=len(s):
                        if s[n:n+len(i)]==i:
                                if dfs(n+len(i)):
                                        return True

        return False
s=input()
print("YES") if dfs(0) else print("NO")

Buggy submission (verdict: Runtime Error):
def dfs(n):
        divide=["dream","erase","eraser","dreamer"]
        if n==len(s):
                return True
        for i in divide:
                if n+len(i)<=len(s):
                        if "".join(s[n:n+len(i)])==i:
                                if dfs(n+len(i)):
                                        return True

        return False
s=list(input())
print("YES") if dfs(0) else print("NO")

Buggy submission (verdict: Runtime Error):
s=list(input())
divide=["dream","erase","eraser","dreamer"]
def dfs(n):
        if n==len(s):
                return True
        for i in divide:
                if n+len(i)<=len(s):
                        if "".join(s[n:n+len(i)])==i:
                                if dfs(n+len(i)):
                                        return True

        return False
print("YES") if dfs(0) else print("NO")

Buggy submission (verdict: Runtime Error):
s=list(input())
divide=["dream","erase","eraser","dreamer"]
def dfs(n):
        if n==len(s):return True
        for i in divide:
                if n+len(i)<=len(s):
                        if "".join(s[n:n+len(i)]):
                                if dfs(n+len(i)):return True
        return False
print("YES") if dfs(0) else print("NO")

Buggy submission (verdict: Runtime Error):
s=list(input())
divide=["dream","erase","eraser","dreamer"]
def dfs(n):
        if n==len(s):
                return True
        for i in divide:
                if n+len(i)<=len(s):
                        if "".join(s[n:n+len(i)]):
                                if dfs(n+len(i)):
                                        return True
        return False
print("YES") if dfs(0) else print("NO")

Buggy submission (verdict: Runtime Error):
s=list(input())
divide=["dream","erase","eraser","dreamer"]
def dfs(n):
        if n==len(s):
                return True
        for i in divide:
                if n+len(i)<=len(s):
                        if "".join(s[n:n+len(i)])==i:
                                if dfs(n+len(i)):
                                        return True
        return False
print("YES") if dfs(0) else print("NO")

Buggy submission (verdict: Runtime Error):
s=list(input())
divide=["dream","erase","eraser","dreamer"]
def dfs(n):
        if n==len(s):
                return True
        for i in divide:
                tmp="".join(s[n:n+len(i)])
                if n+len(i)<=len(s) and tmp==i:
                        if dfs(n+len(i)):
                                return True
        return False
print("YES") if dfs(0) else print("NO")

Buggy submission (verdict: Runtime Error):
s=list(input())
divide=["dream","erase","eraser","dreamer"]
def dfs(n):
        if n==len(s):#最後まで行ったらtrue
                return True
        for i in divide:
                tmp="".join(s[n:n+len(i)])
                if n+len(i)<=len(s) and tmp==i:
                        if dfs(n+len(i)):
                                return True
        return False
if dfs(0):
        print("YES")
else:
        print("NO")
#print("YES") if dfs(0) else print("NO")

Buggy submission (verdict: Runtime Error):
s=list(input())
divide=["dream","erase","eraser","dreamer"]
#全探索する
def dfs(n):
        if n==len(s):#最後まで行ったらtrue
                return True
        for i in divide:
                tmp="".join(s[n:n+len(i)])
                if n+len(i)<=len(s) and tmp==i:
                        if dfs(n+len(i)):
                                return True
        return False
print("YES") if dfs(0) else print("NO")

Buggy submission (verdict: Runtime Error):
s=input()
divide=["dream","erase","eraser","dreamer"]
#全探索する
def dfs(n):
        if n==len(s):#最後まで行ったらtrue
                return True
        for i in divide:
                if n+len(i)<=len(s) and "".join(s[n:n+len(i)])==i:
                        if dfs(n+len(i)):
                                return True
        return False
print("YES") if dfs(0) else print("NO")

Buggy submission (verdict: Runtime Error):
s=list(input())
divide=["dream","erase","eraser","dreamer"]
#全探索する
def dfs(n):
        if n==len(s):#最後まで行ったらtrue
                return True
        for i in divide:
                if n+len(i)<=len(s) and "".join(s[n:n+len(i)])==i:
                        if dfs(n+len(i)):
                                return True
        return False
print("YES") if dfs(0) else print("NO")

Buggy submission (verdict: Runtime Error):
s=list(input())
divide=["dream","erase","eraser","dreamer"]
#全探索する
def dfs(n):
        if n==len(s):#最後まで行ったらtrue
                return True
        for i in divide:
                if n+len(i)<=len(s) and "".join(s[n:n+len(i)])==i:
                        if dfs(n+len(i)):
                                return True
        return False
print("YES") if dfs(0) else print("NO")

Buggy submission (verdict: Runtime Error):
s=list(input())
divide=["dream","erase","eraser","dreamer"]
#全探索する
def dfs(n):
        if n==len(s):#最後まで行ったらtrue
                return True
        for i in divide:
                if n+len(i)<=len(s) and "".join(s[n:n+len(i)])==i:
                        if dfs(n+len(i)):
                                print(n)
                                return True
        return False
print("YES") if dfs(0) else print("NO")

Buggy submission (verdict: Runtime Error):
s=input().replace("erase","").replace("dream",""),replace("eraser","").replace("dreamer","")
if s in "":
    print("YES")
else:
    print("NO")