Buggy python submission (verdict: Runtime Error):
# 文字列反転
def rev (s):
    _re=''.join(list(reversed(s)))
    return _re
 
name = ['dream','dreamer','eraser','erase']
S = input()
S_re = rev(S)
can2 = False
i= 0
while i < len(S_re):
    can = False
    can2 = False
    for div in name:
        if len(S_re[i:]) >= len(div):
            if S_re[i:i+len(div)]==rev(div) :
                i+=len(div)
                can = True
                break
    if can :
        can2 = True
    else:
        can2 = False
        break
if can2:
    print('YES')
else :
    print('No')
 
 coding: utf-8
# 文字列反転
def rev (s):
    _re=''.join(list(reversed(s)))
    return _re

name = ['dream','dreamer','eraser','erase']
S = input()
S_re = rev(S)
can2 = False
i= 0
while i < len(S_re):
    can = False
    can2 = False
    for div in name:
        if len(S_re[i:]) >= len(div):
            if S_re[i:i+len(div)]==rev(div) :
                i+=len(div)
                can = True
                break
    if can :
        can2 = True
    else:
        can2 = False
        break
if can2:
    print('YES')
else :
    print('NO')


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

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# 文字列反転
def rev (s):
    _re=''.join(list(reversed(s)))
    return _re

name = ['dream','dreamer','eraser','erase']
S = input()
S_re = rev(S)
can2 = False
i= 0
while i < len(S_re):
    for div in name:
        if len(S_re[i:]) >= len(div):
            if S_re[i:i+len(div)]==rev(div) :
                i+=len(div)
                can = True
                break
    if can :
        can2 = True
    else:
        can2 = False
        break
if can2:
    print('YES')
else :
    print('NO')

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

Buggy python submission (verdict: Runtime Error):
 coding: utf-8
# 文字列反転
def rev (s):
    _re=''.join(list(reversed(s)))
    return _re

name = ['dream','dreamer','eraser','erase']
S = input()
S_re = rev(S)
can2 = False
i= 0
while i < len(S_re):
    can = False
    can2 = False
    for div in name:
        if len(S_re[i:]) >= len(div):
            if S_re[i:i+len(div)]==rev(div) :
                i+=len(div)
                can = True
                break
    if can :
        can2 = True
    else:
        can2 = False
        break
if can2:
    print('YES')
else :
    print('No')



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

Buggy python submission (verdict: Runtime Error):
ef rev (s):
    _re=''.join(list(reversed(s)))
    return _re

name = ['dream','dreamer','eraser','erase']
S = input()
S_re = rev(S)
can = False
can2 = False
for i in range(len(S_re)):
    for div in name:
        if S_re[i:i+len(div)]==rev(div) :
            i+=len(div)
            can = True
        if can :
            can2 = True
            break
    if not can2 :
        break
if can2 :
    print('YES')
else :
    print('No')


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

Buggy python submission (verdict: Runtime Error):
ef rev (s):
    _re=''.join(list(reversed(s)))
    return _re

name = ['dream','dreamer','eraser','erase']
S = input()
S_re = rev(S)
can = False
can2 = False
for i in range(len(S_re)):
    for div in name:
        if S_re[i:i+len(div)]==rev(div) :
            i+=len(div)
            can = True
        if can :
            can2 = True
            break
    if not can2 :
        break
if can2 :
    print('YES')
else :
    print('No')


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