ZhenlongDai/ACPR huggingface dataset:
Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input().replace("eraser","")
s=s.replace("erase","")
s=s.replace("dreamer","")
s=s.replace("dream","")
if s:
	print("No")
else:
	print("Yes")


Failing test case input:
arrerfmadrc

Expected output:
NO


Actual output:
No


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

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

s = input()

s = s.replace("dreamer","")
s = s.replace("dream","")
s = s.replace("eraser","")
s = s.replace("erase","")


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


Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):

s = input()


s = s.replace("eraser","")
s = s.replace("erase","")
s = s.replace("dreamer","")
s = s.replace("dream","")

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

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())
n = len(s)
temp = ['maerd', 'remaerd', 'esare', 'resare']
s.reverse()

i = 0
while i < n:
    flag = False
    for t in temp:
        if s[:len(t)] == list(t):
            i += len(t) - 1
            flag = True
            break

    if not flag:
        print("NO")
        exit()

print("YES")


Failing test case input:
eq`sfdream

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
s = list(input())
n = len(s)
temp = ['maerd', 'remaerd', 'esare', 'resare']
s.reverse()

i = 0
while i < n:
    flag = False
    for t in temp:
        if s[i:i+len(t)] == list(t):
            i += len(t)
            flag = True
            break

    if not flag:
        print("NO")
        exit()

print("YES")

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()

T = ["dream", "dreamer", "erase", "eraser"]

S = S[::-1]
for i in range(4):
    T[i] = T[i][::-1]

can = True
i = 0
while i < len(S):
    can2 = False
    for t in T:
        if S[i:i + len(t)] == t:
            can2 = True
            i += len(t)
    if can2 == False:
        can = False
        break
    i += 1

if can:
    print("YES")
else:
    print("NO")


Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
S = input()

T = ["dream", "dreamer", "erase", "eraser"]

S = S[::-1]
for i in range(4):
    T[i] = T[i][::-1]

can = True
i = 0
while i < len(S):
    can2 = False
    for t in T:
        if S[i:i + len(t)] == t:
            can2 = True
            i += len(t) - 1
    if can2 == False:
        can = False
        break
    i += 1

if can:
    print("YES")
else:
    print("NO")
Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
words = ("dream", "erase", "eraser", "dreamer")

s = input()

while not s:
    match = False
    for w in words:
        if s.endwith(w):
            s = s[:-len(w)]
            match = True
            break
    if match is False:
        print("NO")
        exit()
print("YES")


Failing test case input:
d`etmfqeq

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
words = ("dream", "erase", "eraser", "dreamer")

s = input()

while len(s) > 0:
    match = False
    for w in words:
        if s.endswith(w):
            s = s[:-len(w)]
            match = True
            break
    if match is False:
        print("NO")
        exit()
print("YES")

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import re
text = input()
matche_str = re.compile(r'^(dream|dreamer|erase|eraser)+$')
mo = matche_str.search(text)

if mo != None:
    print('yes')
else:
    print('no')


Failing test case input:
dre`meqer

Expected output:
NO


Actual output:
no


Fixed submission (verdict: Accepted):
import re
text = input()
matche_str = re.compile(r'^(dream|dreamer|erase|eraser)+$')
mo = matche_str.search(text)
 
if mo != None:
    print('YES')
else:
    print('NO')

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
s.replace("eraser","")
s.replace("erase","")
s.replace("dreamer","")
s.replace("dream","")
if s:
    print("NO")
else:
    print("YES")

Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


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

Problem: p03854
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s = input()
s = s.replace('eraser', '')
s = s.replace('erase', '')
s = s.replace('dreamer', '')
s = s.replace('dream', '')
if s == '':
    print('Yes')
else:
    print('No')


Failing test case input:
qeqfmte`d

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
s = input()
s = s.replace('eraser', '')
s = s.replace('erase', '')
s = s.replace('dreamer', '')
s = s.replace('dream', '')
if s == '':
    print('YES')
else:
    print('NO')
Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
S_r = S[::-1]
dire = ['dream','dreamer','erase','eraser']
dire_r = [0]*4
for i in range(4):
    tmp = dire[i]
    dire_r[i] = tmp[::-1]
ind = 0

excep = 0
while ind  <len(S_r):
    if excep == 1:
        break
    for j in range(4):
        for k in range(len(dire_r[j])):
            if ind + k < len(S_r):
                tmp = dire_r[j]
                if S_r[ind+k] != tmp[k]:
                    flag = 0
                    if j == 3:
                        excep = 1
                        break

                elif k== len(dire_r[j])  -1:
                    ind = ind + len(dire_r[j])
                    print(len(dire_r[j]))
                    flag = 1
                    break

if flag == 1:
    print('YES')
else:
    print('NO')


Failing test case input:
mqetfdr_ae

Expected output:
NO


Actual output:
5
NO


Fixed submission (verdict: Accepted):
S = input()
S_r = S[::-1]
dire = ['dream','dreamer','erase','eraser']
dire_r = [0]*4
for i in range(4):
    tmp = dire[i]
    dire_r[i] = tmp[::-1]
ind = 0

excep = 0

while ind  <len(S_r):
    if excep == 1:
        break
    flag2= 0
    for j in range(4):
        if flag2 ==0:
            case = 0
            for k in range(len(dire_r[j])):
                tmp = dire_r[j]

                if ind + k < len(S_r) and case == 0:
                
            
            
                    if S_r[ind+k] != tmp[k]:
                        flag = 0
                        case = 1
                        if j == 3:
                            excep = 1

                    elif k== len(dire_r[j])  -1:
                        ind = ind + len(dire_r[j])
                        flag = 1
                        case = 1
                        flag2 = 1


if flag == 1:
    print('YES')
else:
    print('NO')

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input().replace('dreamer','1').replace('dream','1').replace('eraser','1').replace('erase','1')
print(s)
if len(s.replace('1','')) == 0:
    print("YES")
else :
    print("NO")

Failing test case input:
qnbfrtead

Expected output:
NO


Actual output:
qnbfrtead
NO


Fixed submission (verdict: Accepted):
s = input().replace('eraser','1').replace('erase','1').replace('dreamer','1').replace('dream','1')
if len(s.replace('1','')) == 0:
    print("YES")
else :
    print("NO")
Problem: p03854
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def solution():
    s = input()
    T = ['dreamer', 'dream', 'eraser', 'erase']
    while True:
        match = False
        for ss in T:
            if s.startswith(ss):
                s = s.lstrip(ss)
                if not s:
                    print('YES')
                    return
                match = True
                break
        if not match:
            print('NO')
            return

solution()

Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
def solution():
    s = input()
    T = ['dreamer', 'dream', 'eraser', 'erase']

    while True:
        match = False
        for ss in T:
            if s.endswith(ss) :
                s = s[:-1*len(ss)]
                if not s:
                    print('YES')
                    return
                match = True
                break
        if not match:
            print('NO')
            return

solution()

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
t=input()
trigger=1
app=['dream','dreamer','erase','eraser']
while len(t)>0 and trigger:
    for i in range(4):
        key=app[i]
        if key==t[:len(key)]:
            t=t[len(key):]
            trigger+=1
            break
    trigger-=1
if t=='':
    print('YES')
else:
    print('NO')

Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
t=input()
trigger=1
key=''
d=-1
app=['dreamer','eraser','dream','erase']
while len(t)>0 and trigger:
    for i in range(4):
        key=app[i]
        if key==t[:len(key)]:
            t=t[len(key):]
            trigger+=1
            d=i
            break
    trigger-=1
    if trigger==0 and d==0 and t[:3]=='ase':
        t='er'+t
        trigger+=1
if t=='':
    print('YES')
else:
    print('NO')

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S=input()

S.replace('eraser','')
S.replace('erase','')
S.replace('dreamer','')
S.replace('dream','')

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

Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
S=input()

S = S.replace('eraser','')
S=S.replace('erase','')
S=S.replace('dreamer','')
S=S.replace('dream','')

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

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input().replace("eracer", "").replace("erace","").replace("dreamer","").replace("dream","")
if s:
    print("NO")
else:
    print("YES")

Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
s = input().replace("eraser", "").replace("erase","").replace("dreamer","").replace("dream","")
if s:
    print("NO")
else:
    print("YES")
Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
s = s[::-1]
s = s.replace('esare', '')
s = s.replace('resare', '')
s = s.replace('maerd', '')
s = s.replace('remaerd', '')
 
if s == '':
    print('YES')
else:
    print('NO')

Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


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

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
s=s.replace('dreamer','')
s=s.replace('dream','')
s=s.replace('eraser','')
s=s.replace('erase','')
if s=='':
  print('Yes')
else:
  print('No')


Failing test case input:
pnbfrtead

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
S=input()
 
S=S.replace('eraser','')
S=S.replace('erase','')
S=S.replace('dreamer','')
S=S.replace('dream','')
 
if S=='':
    print('YES')
else:
    print('NO')

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
txt = input()
cands = ["dream", "dreamer", "erase", "eraser"]

success = True
while len(txt) > 0:
    flag = False

    for cand in cands:
        subtxt = txt[len(txt) - len(cand):]
        if subtxt == cand:
            txt = txt[:len(txt) - len(cand)]
            flag = True
            break

    if not flag:
        success = False
        break

if success:
    print("YES")
else:
    print("No")

Failing test case input:
nqdfrte`d

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
txt = input()
cands = ["dream", "dreamer", "erase", "eraser"]

success = True
while len(txt) > 0:
    flag = False

    for cand in cands:
        subtxt = txt[len(txt) - len(cand):]
        if subtxt == cand:
            txt = txt[:len(txt) - len(cand)]
            flag = True
            break

    if not flag:
        success = False
        break

if success:
    print("YES")
else:
    print("NO")

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

S = input()

t=0
n = int(len(S)/5)+1

def endcheck(t,S):
  if t==len(S):
    print("YES")

for i in range(n):
  if S[t:t+5] =="dream" and S[t:t+7] != "dreamer":
    t += 5
    endcheck(t,S)
  elif S[t:t+7] =="dreamer":
    t += 7
    endcheck(t,S)
  elif S[t:t+5] =="erase" and S[t:t+6] != "eraser":
    t += 5
    endcheck(t,S)
  elif S[t:t+6] =="eraser":
    t += 6
    endcheck(t,S)
  else:
    print("NO")
    break

Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):

S = input()
s =len(S)
t=0

def endcheck(t,s):
  if t==s:
    print("YES")
    
while t < s:
  if S[-t-5:s-t] =="dream":
    t += 5
    endcheck(t,s)
  elif S[-t-7:s-t] =="dreamer":
    t += 7
    endcheck(t,s)
  elif S[-t-5:s-t] =="erase":
    t += 5
    endcheck(t,s)
  elif S[-t-6:s-t] =="eraser":
    t += 6
    endcheck(t,s)
  else:
    print("NO")
    break
Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()

S = S[::-1]

word_list1 = "dream"
word_list2 = "dreamer"
word_list3 = "erase"
word_list4 = "eraser"

s = ""
ans = ""

word_list = [word_list1[::-1],word_list2[::-1],word_list3[::-1],word_list4[::-1]]

for i in S:
    s += i
    if s in word_list:
        ans += s
        s = ""

if S == ans:
    print('Yes')
else:
    print('No')

Failing test case input:
mtb`odee_p

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
S = input()

S = S[::-1]

word_list1 = "dream"
word_list2 = "dreamer"
word_list3 = "erase"
word_list4 = "eraser"

s = ""
ans = ""

word_list = [word_list1[::-1],word_list2[::-1],word_list3[::-1],word_list4[::-1]]

for i in S:
    s += i
    if s in word_list:
        ans += s
        s = ""

if S == ans:
    print('YES')
else:
    print('NO')

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S=input()
n=len(S)
print(n)
while n>0:
    if S[n-5:n]=='dream':
        n-=5
        print(n)
    elif S[n-5:n]=='erase':
        n-=5
    elif S[n-7:n]=='dreamer':
        n-=7
    elif S[n-6:n]=='eraser':
        n-=6
    else:
        print('NO')
        exit()
print('YES')

Failing test case input:
eccrqgl`rra

Expected output:
NO


Actual output:
11
NO


Fixed submission (verdict: Accepted):
S=input()
n=len(S)
while n>0:
    if S[n-5:n]=='dream':
        n-=5
    elif S[n-5:n]=='erase':
        n-=5
    elif S[n-7:n]=='dreamer':
        n-=7
    elif S[n-6:n]=='eraser':
        n-=6
    else:
        print('NO')
        exit()
print('YES')

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


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

Failing test case input:
resaremaerd

Expected output:
NO


Actual output:
resaremaerd
NO


Fixed submission (verdict: Accepted):


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

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

s = input()

while len(s) != 0:
    if s.endswith('dream') or s.endswith('erase'):
        s = s[:-5]
    elif s.endswith('dreamer') or s.endswith('eraser'):
        s = s[:-7]
    else:
        print('NO')
        sys.exit()

print('YES')


Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
import sys

s = input()

while len(s) != 0:
    if s.endswith('dream') or s.endswith('erase'):
        s = s[:-5]
    elif s.endswith('eraser'):
        s = s[:-6]
    elif s.endswith('dreamer'):
        s = s[:-7]
    else:
        print('NO')
        sys.exit()

print('YES')
Problem: p03854
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import re
sin = input()
match = re.match(r"^.*(dream|dreamer|erase|eraser)+$",sin)
print("YES" if match else "NO")

Failing test case input:
er`sedream

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
import re
sin = input()
match = re.match(r"^(dream|dreamer|erase|eraser)+$",sin)
print("YES" if match else "NO")

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
words = ["dream", "dreamer", "erase","eraser"]
reverse_words = []
for word in words:
    reverse_words.append(word[::-1])
S = input()
S = S[::-1]

while len(S) !=0:
    flag = 0
    for word in reverse_words:
        if S.startswith(word):
            S = S[len(word):]
            flag=1
            break
    if (not flag):
        print("No")
        quit()
print("Yes")


Failing test case input:
qccrdgk`srb

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
words = ["dream", "dreamer", "erase","eraser"]
reverse_words = []
for word in words:
    reverse_words.append(word[::-1])
S = input()
S = S[::-1]

while len(S) !=0:
    flag = 0
    for word in reverse_words:
        if S.startswith(word):
            S = S[len(word):]
            flag=1
            break
    if (not flag):
        print("NO")
        quit()
print("YES")

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input().replace('eraser','1').replace('erase','1').replace('dreamer','1').replace('dream','1')
print(s)
if len(s.replace('1','')) == 0:
    print("YES")
else :
    print("NO")

Failing test case input:
t`epdp`bem

Expected output:
NO


Actual output:
t`epdp`bem
NO


Fixed submission (verdict: Accepted):
s = input().replace('eraser','1').replace('erase','1').replace('dreamer','1').replace('dream','1')
if len(s.replace('1','')) == 0:
    print("YES")
else :
    print("NO")

Problem: p03854
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
A = "".join(list(reversed(S)))
print(A)
i = 0

while i != len(S):
    if A[i:i+5] == "maerd":
        i += 5
    elif A[i:i+5] == "esare":
        i += 5
    elif A[i:i+7] == "remaerd":
        i += 7
    elif A[i:i+6] == "resare":
        i += 6
    else:
        print("NO")
        exit()
print("YES")

Failing test case input:
cte`meqeq

Expected output:
NO


Actual output:
qeqem`etc
NO


Fixed submission (verdict: Accepted):
S = input()
A = "".join(list(reversed(S)))
i = 0

while i != len(S):
    if A[i:i+5] == "maerd":
        i += 5
    elif A[i:i+5] == "esare":
        i += 5
    elif A[i:i+7] == "remaerd":
        i += 7
    elif A[i:i+6] == "resare":
        i += 6
    else:
        print("NO")
        exit()
print("YES")
Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
s.replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if s:
    print("NO")
else:
    print("YES")


Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


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

Problem: p03854
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
s = input()[::-1]
ls = ['dream', 'dreamer', 'erase', 'eraser']
ls = [ls[i][::-1] for i in range(4)]

ans = 'YES'
i = 0
while i < len(s):
    ng = 1
    for j in range(4):
        if s[i:i+len(ls[j])] == ls[j]:
            i += len(ls[j])
            ng = 0
    if ng:
        ans = 'No'
        break
print(ans)

Failing test case input:
ta`pdpeeem

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
s = input()[::-1]
ls = ['dream', 'dreamer', 'erase', 'eraser']
ls = [ls[i][::-1] for i in range(4)]
ans = 'YES'
i = 0
while i < len(s):
    ng = 1
    for j in range(4):
        if s[i:i+len(ls[j])] == ls[j]:
            i += len(ls[j])
            ng = 0
    if ng:
        ans = 'NO'
        break
print(ans)

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()[::-1]
words=["dreamer","eraser","dream","erase"]
add=0
while add!=len(s):
    cnt=0
    for i in words:
        length=len(i)
        word=s[add:add+length][::-1]
        if word==i:
            add +=length
            break
        else:cnt +=1
    if cnt==4:print("No");exit()
print("Yes")

Failing test case input:
mqefrte`d

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
s=input()[::-1]
words=["dreamer","eraser","dream","erase"]
add=0
while add!=len(s):
    cnt=0
    for i in words:
        length=len(i)
        word=s[add:add+length][::-1]
        if word==i:
            add +=length
            break
        else:cnt +=1
    if cnt==4:print("NO");exit()
print("YES")

Problem: p03854
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
s=s[::-1]


i=0
ans="Yes"
while True:
    if len(s)==i:
        break
    elif s[i:i+5]=="maerd":
        i+=5
    elif s[i:i+7]=="remared":
        i+=7
    elif s[i:i+5]=='esare':
        i+=5
    elif s[i:i+6]=='resare':
        i+=6
    else:
        ans="No"
        break
print(ans)


Failing test case input:
eq_tfdream

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
s = input()
s=s[::-1]
i=0
ans="YES"
while True:
    if len(s)==i:
        break
    elif s[i:i+5]=="maerd":
        i+=5
    elif s[i:i+7]=="remaerd":
        i+=7
    elif s[i:i+5]=='esare':
        i+=5
    elif s[i:i+6]=='resare':
        i+=6
    else:
        ans="NO"
        break
print(ans)
Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

sc = ["dreameracer", "dreamerace", "dreamer", "dream", "eracer", "erace"]
for i in sc:
    s = s.replace(i, '')

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

Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
S = input()

sc = ["dreameraser", "dreamerase", "eraser", "dreamer", "dream", "erase"]
for i in sc:
    S = S.replace(i, "p")

S = S.replace("p", "")

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

Problem: p03854
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S=input()
S=S[::-1]
N=len(S)

index=0
words=["maerd","remaerd","esare","resare"]
while index<N:
    word1=S[index:index+5]
    word2=S[index:index+7]
    if word1 in words:
        index+=5
    elif word2 in words:
        index+=7
    else:
        print("NO")
        exit()
print("YES")

Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
S=input()
S=S[::-1]
N=len(S)

index=0
words=["dream","dreamer","erase","eraser"]
for i in range(4):
    words[i]=words[i][::-1]

while index<N:
    word1=S[index:index+5]
    word2=S[index:index+6]
    word3=S[index:index+7]
    if word1 in words:
        index+=5
    elif word2 in words:
        index+=6
    elif word3 in words:
        index+=7
    else:
        print("NO")
        exit()
print("YES")

Problem: p03854
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()

if s.replace("dreamer", "").replace("dream", "").replace("eraser", "").replace("eras", ""):
    print("NO")
else:
    print("YES")

Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
s = input()

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

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()[::-1]
dividor = ['dream','dreamer','erase','eraser']
j=0
while True:
    flag = 0
    for d in dividor:
        print(S[j:j+len(d)])
        if S[j:j+len(d)]==d[::-1]:
            flag = 1
            j+=len(d)
            if j==len(S):
                print("YES")
                quit()
    if flag==0:
        print("NO")
        quit()

Failing test case input:
reqem`erd

Expected output:
NO


Actual output:
dre`m
dre`meq
dre`m
dre`me
NO


Fixed submission (verdict: Accepted):
S = input()[::-1]
dividor = ['dream','dreamer','erase','eraser']
j=0
while True:
    flag = 0
    for d in dividor:
        if S[j:j+len(d)]==d[::-1]:
            flag = 1
            j+=len(d)
            if j==len(S):
                print("YES")
                quit() 
    if flag==0:
        print("NO")
        quit()
Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
words = ["dream", "dreamer", "erase", "eraser"]
s = input()
dp = [0] * (len(s)+1)
dp[0] = 1

for i in range(len(s)+1):
  if dp[i]!=1: continue
  for word in words:
    if word in s[i:i+len(word)]:
      dp[i+len(word)] = 1
      
print("Yes" if dp[len(s)] else "No")



Failing test case input:
taepdp`eem

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
words = ["dream", "dreamer", "erase", "eraser"]
s = input()
dp = [0] * (len(s)+1)
dp[0] = 1

for i in range(len(s)+1):
  if dp[i]!=1: continue
  for word in words:
    if word in s[i:i+len(word)]:
      dp[i+len(word)] = 1
      
print("YES" if dp[len(s)] else "NO")

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
words = "eraser", "erase", "dreamer", "dream"

for word in words:
    s = s.replace(word, "")
    print(s)

print("YES" if len(s) == 0 else "NO")


Failing test case input:
d`etqfqem

Expected output:
NO


Actual output:
d`etqfqem
d`etqfqem
d`etqfqem
d`etqfqem
NO


Fixed submission (verdict: Accepted):
s = input()
words = "eraser", "erase", "dreamer", "dream"

for word in words:
    s = s.replace(word, "")

print("YES" if len(s) == 0 else "NO")

Problem: p03854
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
s=s[::-1]
A=["dream","dreamer","erase","eraser"]
for i in range(len(A)):
    A[i]=A[i][::-1]

i=0
ans="Yes"
while True:
    if len(s)==i:
        break
    elif s[i:i+5]==A[0]:
        i+=5
    elif s[i:i+7]==A[1]:
        i+=7
    elif s[i:i+5]==A[2]:
        i+=5
    elif s[i:i+6]==A[3]:
        i+=6
    else:
        ans="No"
        break
print(ans)

Failing test case input:
arr`lgqrcce

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
s = input()
s=s[::-1]
i=0
ans="YES"
while True:
    if len(s)==i:
        break
    elif s[i:i+5]=="maerd":
        i+=5
    elif s[i:i+7]=="remaerd":
        i+=7
    elif s[i:i+5]=='esare':
        i+=5
    elif s[i:i+6]=='resare':
        i+=6
    else:
        ans="NO"
        break
print(ans)
Problem: p03854
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

s = input()
n = len(s)
i = 0
while i < n:
    if s[i:i+7] == 'dreamer':
        i += 7
    elif s[i:i+6] == 'eraser':
        i += 6
    elif s[i:i+5] == 'dream':
        i += 5
    elif s[i:i+5] == 'erase':
        i += 5
    else:
        print('NO')
        break
else:
    print('YES')

Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

s = input()
n = len(s)
i = n
while i > 0:
    if s[i-7:i] == 'dreamer' and i-7 >= 0:
        i -= 7
    elif s[i-6:i] == 'eraser' and i-6 >= 0:
        i -= 6
    elif s[i-5:i] == 'dream' and i-5 >= 0:
        i -= 5
    elif s[i-5:i] == 'erase' and i-5 >= 0:
        i -= 5
    else:
        print('NO')
        break
else:
    print('YES')

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s= input()
u= s[::-1]
 
k=["resare","esare","remaerd","maerd"]
 
l=u.replace("resare","")
d=l.replace("esare","")
h=d.replace("remaerd","")
w=h.replace("maerd","")
  
    
if w:
  print("YES")
  
else:
  print("NO")

Failing test case input:
tmepdp`be_

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
s= input()
u= s[::-1]
 
k=["resare","esare","remaerd","maerd"]
 
l=u.replace("resare","")
d=l.replace("esare","")
h=d.replace("remaerd","")
w=h.replace("maerd","")
  
    
if w:
  print("NO")
  
else:
  print("YES")
Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

if __name__ == '__main__':
    S = sys.stdin.readline().rstrip()

    ls = ['dream', 'dreamer', 'erase', 'eraser']
    ls = sorted(ls, key=lambda x: -len(x))

    while S != '':
        for w in ls:
            if S.find(w) == 0:
                S = S[len(w):]
                break
        else:
            print('NO')
            exit()

    print('YES')


Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
import sys

if __name__ == '__main__':
    S = sys.stdin.readline().rstrip()

    ls = ['dream', 'dreamer', 'erase', 'eraser']
    lenS = len(S)
    dp = [False for i in range(lenS + 10)]

    dp[0] = True

    for i in range(lenS):
        if not dp[i]:
            continue

        for w in ls:
            if S[i:i+len(w)] == w:
                dp[i+len(w)] = True

    r = 'YES' if dp[len(S)] else 'NO'

    print(r)

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
i=0
ans=True
while i<=len(s)-1:
    if s[i:i+7]=='dreamer':
        i+=7
    elif s[i:i+5]=='dream':
        i+=5
    elif s[i:i+6]=='eraser':
        i+=6
    elif s[i:i+5]=='erase':
        i+=5
    else:
        ans=False
        break
if ans:
    print('Yes')
else:
    print('No')

Failing test case input:
cre`mdqer

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
s=input()
i=len(s)
ans=True
while 3<=i:
    if s[i-7:i]=='dreamer':
        i-=7
    elif s[i-5:i]=='dream':
        i-=5
    elif s[i-6:i]=='eraser':
        i-=6
    elif s[i-5:i]=='erase':
        i-=5
    else:
        ans=False
        break
if ans:
    print('YES')
else:
    print('NO')
Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
st = input()

sample = ['dream', 'dreamer', 'erase', 'eraser']

sample_edit = ['erase', 'eraser', 'dreamer','dream']
sample_er = ['er']
sample_dr = ['dream']
sample_ase = ['ase', 'aser']

ret = 'No'
reg_len = 0
fd_word = ''
dream_flg = False
end_flg = False

while( len(st) != 0 ):
  if reg_len == len(st):
    break
  
  reg_len = len(st)
  for i in range(len(sample_edit)):
    fd = st.startswith(sample_edit[i])
    
    if fd > 0:
      
      
      st = ''.join(st[len(sample_edit[i]):len(st)])
      break
    
        
  if end_flg == True:
    break
    
  if len(st) == 0:
    ret = 'Yes'
    
  
  

print( ret )

Failing test case input:
eq`sedream

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
st = input()

sample = ['dream', 'dreamer', 'erase', 'eraser']
sample_edit = ['dream', 'eraser','erase', 'er']
sample_er = ['er']
sample_dr = ['dream']
sample_ase = ['ase', 'aser']

ret = 'NO'
reg_len = 0
fd_word = ''
dream_flg = False
end_flg = False

word = ''
length = len(sample_edit)


while( True ):
  if reg_len == len(st):
    break
  
  reg_len = len(st)
  for i in range(length):
    word = sample_edit[i]
    fd = st.startswith(word)
    
    if fd > 0:
      
      
      
      st = st[len(word):len(st)]
        
      if word == 'dream':
        dream_flg = True
      elif word == 'er':
        if dream_flg == False:
          end_flg = True
        else:
          dream_flg = False
      
      break
    
        
  if end_flg == True:
    break
    
  if len(st) == 0:
    ret = 'YES'
    break
    
  
  

print( ret )

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()

S.replace("dream",'')
S.replace("dreamer",'')
S.replace("erase",'')
S.replace("eraser",'')

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

print(ans)


Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
S = input()
S = S.replace('eraser', '')
S = S.replace('erase', '')
S = S.replace('dreamer', '')
S = S.replace('dream', '')
if len(S) == 0:
    print('YES')
else:
    print('NO')

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
S = list(S)
s = ''.join(list(reversed(S)))
def main(s):
  l = ["esare", "maerd", "resare", "remaerd"]
  for i in l:
    s = s.replace(i, '')
  return s
if main(s) == '':
  print('YES')
elif main(s) != '':
  print('NO')

Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
S = input()
S = list(S)
s = ''.join(list(reversed(S)))
def main(s):
  l = ["resare", "esare","remaerd", "maerd"]
  for i in l:
    s = s.replace(i, '')
  return s
if main(s) == '':
  print('YES')
elif main(s) != '':
  print('NO')
Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

def reverse(string):
  return ''.join(reversed(string))

def split_and_join(string, word):
  return ''.join(string.split(word))

reversed_s = reverse(s)
ls = ["eraser", "dreamer", "erase", "dream"]

for word in ls:
  reversed_word = reverse(word)
  reversed_s = split_and_join(reversed_s, reversed_word)
  
print(reversed_s)

Failing test case input:
cse`meqeq

Expected output:
NO


Actual output:
qeqem`esc


Fixed submission (verdict: Accepted):
s = input()

def reverse(string):
  return ''.join(reversed(string))

def split_and_join(string, word):
  return ''.join(string.split(word))

s_r = reverse(s)
ls = ["eraser", "erase", "dreamer", "dream"]
ls_r = []
for item in ls:
  ls_r.append(reverse(item))

for word_r in ls_r:
  s_r = split_and_join(s_r, word_r)
  
ans = "YES" if s_r == '' else "NO"

print(ans)

Problem: p03854
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a = input()

b = a[::-1]

i = 0
while i  < len(b):
    if b[i:i+5] == "esare":
        i += 5
    elif b[i:i+5] == "maerd":
        i += 5
    elif b[i:i+6] == "resare":
        i += 6
    elif b[i:i+7] == "remaerd":
        i += 7
    else:
        ans = "No"
        break

if i  == len(b):
    ans = "Yes"
else:
    ans = "No"

print(ans)

Failing test case input:
eq`sedream

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
a = input()

b = a[::-1]

i = 0
while i  < len(b):
    if b[i:i+5] == "esare":
        i += 5
    elif b[i:i+5] == "maerd":
        i += 5
    elif b[i:i+6] == "resare":
        i += 6
    elif b[i:i+7] == "remaerd":
        i += 7
    else:
        ans = "NO"
        break

if i  == len(b):
    ans = "YES"
else:
    ans = "NO"

print(ans)

Problem: p03854
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s = input()
s.replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
print("YES") if s == "" else print("NO")

Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
s = input()
s = s.replace("eraser", "").replace("erase", "").replace("dreamer", "").replace("dream", "")
print("YES") if s == "" else print("NO")
Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
S_r = S[::-1]
dire = ['dream','dreamer','erase','eraser']
dire_r = [0]*4
for i in range(4):
    tmp = dire[i]
    dire_r[i] = tmp[::-1]
ind = 0

excep = 0
while ind  <len(S_r):
    if excep == 1:
        break
    for j in range(4):
        for k in range(len(dire_r[j])):
            if ind + k < len(S_r):
                tmp = dire_r[j]
                if S_r[ind+k] != tmp[k]:
                    flag = 0
                    if j == 3:
                        excep = 1
                        break

                elif k== len(dire_r[j])  -1:
                    ind = ind + len(dire_r[j])
                    flag = 1
                    break

if flag == 1:
    print('YES')
else:
    print('NO')


Failing test case input:
er`sedream

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
S = input()
S_r = S[::-1]
dire = ['dream','dreamer','erase','eraser']
dire_r = [0]*4
for i in range(4):
    tmp = dire[i]
    dire_r[i] = tmp[::-1]
ind = 0

excep = 0

while ind  <len(S_r):
    if excep == 1:
        break
    flag2= 0
    for j in range(4):
        if flag2 ==0:
            case = 0
            for k in range(len(dire_r[j])):
                tmp = dire_r[j]

                if ind + k < len(S_r) and case == 0:
                
            
            
                    if S_r[ind+k] != tmp[k]:
                        flag = 0
                        case = 1
                        if j == 3:
                            excep = 1

                    elif k== len(dire_r[j])  -1:
                        ind = ind + len(dire_r[j])
                        flag = 1
                        case = 1
                        flag2 = 1


if flag == 1:
    print('YES')
else:
    print('NO')

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
s = input()
i = 0
while s[i:5] != '':
    if s[i:5] == 'dream':
        if s[i+5:i+10] == 'dream':
            i += 5
        elif s[i+5:i+10] == 'erase':
            i += 5
        elif s[i+5:i+7] == 'er':
            i += 7
        else:
            print('NO')
            sys.exit(0)
    elif s[i:5] == 'erase':
        if s[i+5:i+10] == 'dream':
            i += 5
        elif s[i+5:i+10] == 'erase':
            i += 5
        elif s[i+5:i+6] == 'r':
            i += 6
        else:
            print('NO')
            sys.exit(0)
    else:
        print('NO')
        sys.exit(0)
print('YES')

Failing test case input:
dreamerer

Expected output:
NO

Actual output:
YES


Fixed submission (verdict: Accepted):
import sys
s = input()
i = 0
while s[i:i+5] != '':
    if s[i:i+5] == 'dream':
        if s[i+5:i+10] == 'dream':
            i += 5
        elif s[i+5:i+10] == 'erase':
            i += 5
        elif s[i+5:i+7] == 'er':
            i += 7
        else:
            i += 5
    elif s[i:i+5] == 'erase':
        if s[i+5:i+10] == 'dream':
            i += 5
        elif s[i+5:i+10] == 'erase':
            i += 5
        elif s[i+5:i+6] == 'r':
            i += 6
        else:
            i += 5
    else:
        print('NO')
        sys.exit(0)
print('YES')
Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
n = len(s) 
for i in range(n + 1):
   if len(s) == 0:
      print('YES')
      exit()
   if s[:5] == 'erase':
      s = s[5:]
   elif s[:6] == 'easer':
      s = s[6:]
   elif (s[:6] == 'dreamer') and ((s[:10] != 'dreamerase') or (s[:11] != 'dreameraser')):
      s = s[6:]
   elif (s[:5] == 'dream'):
      s = s[5:]
   else:
      print('NO')
      exit()

Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
s = input()
n = len(s) 
for i in range(n + 1):
   if len(s) == 0:
      print('YES')
      exit()
   if s[:6] == 'eraser':
      s = s[6:]
   elif s[:5] == 'erase':
      s = s[5:]
   elif ((s[:7] == 'dreamer') and (s[:10] != 'dreamerase') and (s[:11] != 'dreameraser')) or ((len(s) == 7) and (s == 'dreamer')):
      s = s[7:]
   elif (s[:5] == 'dream'):
      s = s[5:]
   else:
      print('NO')
      exit()

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
sr = ''
for i in S:
    sr = i + sr
lista = ['remaerd','resare','esare','maerd']
for i in lista:
    sr = sr.replace(i,'')

if sr == '':
    print('YES')
else:
    print('NO')


Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
S = input()
sr = ''
for i in S:
    sr = i + sr
lista = ['remaerd','resare','esare','maerd']
c = 0
while c == 0:
    c = 1
    for i in lista:
        
        if sr[0:len(i)] == i:
            sr = sr[len(i):]
            c = 0

if sr == '':
    print('YES')
else:
    print('NO')

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()

partstrs = ["eraser", "erase", "dreamer", "dream"]

for s in partstrs:
    S = S.replace(s , "") 
if S=="":
    print("Yes")
else:
    print("No")

Failing test case input:
rrrcafe`drl

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
S = input()

partstrs = ["eraser", "erase", "dreamer", "dream"]

for s in partstrs:
    S = S.replace(s , "") 
if S=="":
    print("YES")
else:
    print("NO")

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()

a = ['dream','dreamer','erase','eraser']
for i,ch in enumerate(a):
  a[i] = ch[::-1]

S = S[::-1]

flag = True
while flag:
  if len(S)==0:
    ans  = 'Yes'
    flag = False
  elif S[:5] in a:
    S = S[5:]
  elif S[:6] in a:
    S = S[6:]
  elif S[:7] in a:
    S = S[7:]
  else:
    ans  = 'No'
    flag = False
  
print(ans)

Failing test case input:
d`etmfqeq

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
S = input()

a = ['dream','dreamer','erase','eraser']
for i,ch in enumerate(a):
  a[i] = ch[::-1]

S = S[::-1]

flag = True
while flag:
  if len(S)==0:
    ans  = 'YES'
    flag = False
  elif S[:5] in a:
    S = S[5:]
  elif S[:6] in a:
    S = S[6:]
  elif S[:7] in a:
    S = S[7:]
  else:
    ans  = 'NO'
    flag = False
  
print(ans)
Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = str(input())
str_list = ['dream', 'dreamer', 'erase', 'eraser']
dp = [0] * 100010

for i in range(len(S)):
    for s in str_list:
        if S[i:i+len(s)] == s:
            dp[i+len(s)] = 1

if dp[len(S)] == 1:
    print('YES')
else:
    print('NO')

Failing test case input:
eq`sedream

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):


S = str(input())
words = ['dream', 'dreamer', 'erase', 'eraser']
dp = [0] * 100010

dp[0] = 1
for i in range(len(S)):
    if not dp[i]:
        continue
    for w in words:
        if S[i:i+len(w)] == w:
            dp[i+len(w)] = 1

if dp[len(S)] == 1:
    print('YES')
else:
    print('NO')

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
sr = s[::-1]
w = ["maerd","remaerd","esare","resare"]
for i in range(4):
    sr = sr.replace(w[i],"")
if sr == "":print("Yes")
else:print("No")


Failing test case input:
ersarfmadrd

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
s = input()
sr = s[::-1]
w = ["resare","esare","remaerd","maerd"]
for i in range(4):
    sr = sr.replace(w[i],"")
if sr == "":print("YES")
else:print("NO")

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input().replace("dream", "").replace("dreamer", "").replace("erase", "").replace("eraser", "")
if s:
    print("NO")
else:
    print("YES") 

Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


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

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s="dreamerer"

s=s.replace('eraser','').replace('erase','').replace('dreamer','').replace('dream','')

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


Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
s=input()
s=s.replace('eraser','0').replace('erase','0').replace('dreamer','0').replace('dream','0')
s=s.replace('0','')

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

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
while len(S) > 0:
    if S[-5::1] == 'dream' or S[-5::1] == 'erase':
        S = S[:-5:1]
    elif S[-6::1] == 'eraser':
        S = S[:-6:1]
    elif S[-7::1] == 'dreamer':
        S = S[:-7:1]
    else:
        print('No')
        break

if len(S) == 0:
    print('Yes')

Failing test case input:
reqem`erc

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
S = input()
while len(S) > 0:
    if S[-5::1] == 'dream' or S[-5::1] == 'erase':
        S = S[:-5:1]
    elif S[-6::1] == 'eraser':
        S = S[:-6:1]
    elif S[-7::1] == 'dreamer':
        S = S[:-7:1]
    else:
        print('NO')
        break

if len(S) == 0:
    print('YES')
Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input().replace('eraser', '').replace('erase', '').replace('dreamer', '').replace('dream', '')
if s:
    print('no')
else:
    print('yes')

Failing test case input:
ta`qdqeeel

Expected output:
NO


Actual output:
no


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

Problem: p03854
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=input()
s.replace("eraser","")
s.replace("erase","")
s.replace("dreamer","")
s.replace("dream","")

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

Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


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

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
c = ["dream","dreamer","erase","eraser"]

S = S[::-1]
c = [cc[::-1] for cc in c]

i=0
while i < len(c):
    if S.startswith(c[i]):
        S = S[len(c[i]):]
        i = 0
        continue
    i = -~i

if S=="":
    print("Yes")
else:
    print("No")

Failing test case input:
brs`lgdrccq

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
S = input()
c = ["dream","dreamer","erase","eraser"]

S = S[::-1]
c = [cc[::-1] for cc in c]

i=0
while i < len(c):
    if S[:len(c[i])] == c[i]:
        S = S[len(c[i]):]
        i = 0
        continue
    i += 1

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

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

a = s.count("dream")
b = s.count("dreamer")
c = s.count("erase")
d = s.count("eraser")
if a*5 + b*7 + c*5 + d*6 == len(s):
  print("YES")
else:
  print("NO")

Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
s = input()
 
x = s.count("dreamerase")
a = s.count("dreamer") - x
b = s.count("dream") - a 
c = s.count("eraser")
d = s.count("erase") - c

if a*7 + b*5 + c*6 + d*5 == len(s):
  print("YES")
else:
  print("NO")

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import re
print("YES" if re.match("^(dream|dreamer|erase|eraser)+$", input()) else 'No')

Failing test case input:
qeqdm`esc

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
import re
print("YES" if re.match("^(dream|dreamer|erase|eraser)+$", input()) else 'NO')

Problem: p03854
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin, stdout
S = stdin.readline()
S = S.replace("eraser", "")
S = S.replace("erase", "")
S = S.replace("dreamer", "")
S = S.replace("dream", "")
print("YES") if not S else print("NO")

Failing test case input:
dreameraser

Expected output:
YES

Actual output:
NO


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