Problem p03854 (python)

Fixed submission:
def main():
    S = input()

    while len(S) >= 5:
        if len(S) >= 7 and S[-7:] == "dreamer":
            S = S[:-7]
            continue

        if len(S) >= 6 and S[-6:] == "eraser":
            S = S[:-6]
            continue

        elif S[-5:] == "dream" or S[-5:] == "erase":
            S = S[:-5]
            continue

        else:
            break

    if len(S) == 0:
        print("YES")
    else:
        print("NO")

main()

Buggy submission (verdict: Runtime Error):
import re

def hoge(str):
	if str == "":
		return True
	for word in ["dreamer", "eraser", "dream", "erase"]:
		keyword = word[::-1]
		pattern = re.compile(r"^%s" % keyword)
		if(pattern.match(str)):
			return hoge(re.sub(pattern, "", str))
	return False

S= input()

if(hoge(S[::-1])):
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
import re
S=input()

def hoge(str):
	if str == "":
		return True
	for word in ["dreamer", "eraser", "dream", "erase"]:
		keyword = word[::-1]
		pattern = re.compile(r"^%s" % keyword)
		if(str.startswith(keyword)):
			return hoge(re.sub(pattern, "", str))
	return False

if(hoge(S[::-1])):
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
S=input()

def hoge(str):
	if str == "":
		return True
	for word in ["dreamer", "eraser", "dream", "erase"]
		keyword = word.sort(reverse=True)
		pattern = re.compile(r"^%s" % keyword)
		if(str.startswith(keyword)):
			return hoge(str.relpace(pattern, ""))
	return False

if hoge(S.sort(reverse=True)):
	print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
S=input()

def hoge(str)
	if str == "":
		return True
	for word in ["dreamer", "eraser", "dream", "erase"]
		keyword = word.sort(reverse=True)
		pattern = re.compile(r"^%s" % keyword)
		if(str.startswith(keyword)):
			return hoge(str.relpace(pattern, ""))
	return False

if hoge(S.sort(reverse=True)):
	print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
import re
s=input()

def hoge(str):
	if(str == ""):
		return "YES"
	if(str.startswith("remaerd")):
		return hoge(re.sub('^remaerd', '', str))
	if(str.startswith("resare")):
		return hoge(re.sub('^resare', '', str))
	if(str.startswith("maerd")):
		return hoge(re.sub('^maerd', '', str))
	if(str.startswith("esare")):
		return hoge(re.sub('^esare', '', str))
	return "NO"

if(s == ""):
  print("NO")
else:
	print(hoge(s[::-1]))

Buggy submission (verdict: Runtime Error):
import re
s=input()

def hoge(str):
	if(str == ""):
		return "YES"
	if(str.startswith("maerd")):
		return hoge(re.sub('^maerd', '', str))
	if(str.startswith("remaerd")):
		return hoge(re.sub('^remaerd', '', str))
	if(str.startswith("esare")):
		return hoge(re.sub('^esare', '', str))
	if(str.startswith("resare")):
		return hoge(re.sub('^resare', '', str))
	return "NO"

if(s == ""):
  print("NO")
else:
	print(hoge(s[::-1]))

Buggy submission (verdict: Runtime Error):
import re
s=input()

def hoge(str):
	if(str == ""):
		return "YES"
	if(str.startswith("maerd")):
		return hoge(re.sub('^maerd', '', str))
	if(str.startswith("remaerd")):
		return hoge(re.sub('^remaerd', '', str))
	if(str.startswith("esare")):
		return hoge(re.sub('^esare', '', str))
	if(str.startswith("resare")):
		return hoge(re.sub('^resare', '', str))
	return "NO"

print(hoge(s[::-1]))

Buggy submission (verdict: Runtime Error):
import re
s=input()

def hoge(str):
	if(str == ""):
		return "YES"
	if(str.startWith("dream".sort(reverse=True))):
		return hoge(re.sub('^maerd', '', str))
	if(str.startWith("dreamer".sort(reverse=True))):
		return hoge(re.sub('^remerd' '', str))
	if(str.startWith("erase".sort(reverse=True))):
		return hoge(re.sub('^esare', '', str))
	if(str.startWith("eraser".sort(reverse=True))):
		return hoge(re.sub('^resare', '', str))
	return "NO"

print(s.sort(reverse=True))

Buggy submission (verdict: Runtime Error):
import re
s=input()

def hoge(str):
    if(str == ""):
    	return "YES"
	if(str.startWith("dream".sort(reverse=True))):
		return hoge(re.sub('^maerd', '', str))
	if(str.startWith("dreamer".sort(reverse=True))):
		return hoge(re.sub('^remerd' '', str))
	if(str.startWith("erase".sort(reverse=True))):
		return hoge(re.sub('^esare', '', str))
	if(str.startWith("eraser".sort(reverse=True))):
		return hoge(re.sub('^resare', '', str))
	return "NO"

print(s.sort(reverse=True))

Buggy submission (verdict: Runtime Error):
import re
s=input()

def hoge(str)
    if(str == ""):
    	return "YES"
	if(str.startWith("dream".sort(reverse=True))):
		return hoge(re.sub('^maerd', '', str))
	if(str.startWith("dreamer".sort(reverse=True))):
		return hoge(re.sub('^remerd' '', str))
	if(str.startWith("erase".sort(reverse=True))):
		return hoge(re.sub('^esare', '', str))
	if(str.startWith("eraser".sort(reverse=True))):
		return hoge(re.sub('^resare', '', str))
	return "NO"

print(s.sort(reverse=True))

Buggy submission (verdict: Runtime Error):
import re
s=input()

def hoge(str)
    res = []
	if(str.startWith("dream")):
		res.append(re.sub('^dream', '', str))
	if(str.startWith("dreamer")):
		res.append(re.sub('^dreamer', '', str))
	if(str.startWith("erase")):
		res.append(re.sub('^erase', '', str))
	if(str.startWith("eraser")):
		res.append(re.sub('^eraser', '', str))
	return res

def fuga(res):
	if(len(res) == 0):
  		return "NO"
	if("" in res):
  		return "YES"
	for str in res:
        return fuga(hoge(str))
print(fuga([s])

Buggy submission (verdict: Runtime Error):
import re
s=input()

def hoge(str)
	if(str == ""):
  		return "YES"
	if(str.startWith("dream")):
		return hoge(re.sub('^dream', '', str))
	if(str.startWith("dreamer")):
		return hoge(re.sub('^dreamer', '', str))
	if(str.startWith("erase")):
		return hoge(re.sub('^erase', '', str))
	if(str.startWith("eraser")):
		return hoge(re.sub('^eraser', '', str))
	return "NO"

print(hoge(s))

Buggy submission (verdict: Runtime Error):
s=input()

def hoge(str)
	if(str == ""):
  		return "YES"
	if(str.startWith("dream")):
		return hoge(str.rstrip("dream"))
	if(str.startWith("dreamer")):
		return hoge(str.rstrip("dreamer"))
	if(str.startWith("erase")):
		return hoge(str.rstrip("erase"))
	if(str.startWith("eraser")):
		return hoge(str.rstrip("eraser"))
	return "NO"

print(hoge(s))