Problem:


Score : 300 points

Problem Statement

You are given a string S consisting of lowercase English letters.
Another string T is initially empty.
Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:

Append one of the following at the end of T: dream, dreamer, erase and eraser.

Constraints

1≦|S|≦10^5

S consists of lowercase English letters.

Input

The input is given from Standard Input in the following format:

S

Output

If it is possible to obtain S = T, print YES. Otherwise, print NO.

Sample Input 1

erasedream

Sample Output 1

YES

Append erase and dream at the end of T in this order, to obtain S = T.

Sample Input 2

dreameraser

Sample Output 2

YES

Append dream and eraser at the end of T in this order, to obtain S = T.

Sample Input 3

dreamerer

Sample Output 3

NO



Sample input:
erasedream


Sample output:
YES

Submission status: Wrong Answer

Solution code:
import re

s = input()
re_list = [r'dream$', r'dreamer$', r'erase$', r'eraser$']
while True:
  if s == '':
    print('YES')
    break
  for regex in re_list:
    m = re.sub(regex, '', s)
    if m != s:
      s = m
      continue
  else:
    print('NO')
    break

Submission status: Wrong Answer

Solution code:
S = input()

result = "NO"

while True:
    if S[-5:] == "dream":
        if len(S) == 5:
            result = "YES"
            break
        S = S.rstrip("dream")
    elif S[-5:] == "erase":
        if len(S) == 5:
            result = "YES"
            break
        S = S.rstrip("erase")
    elif S[-6:] == "eraser":
        if len(S) == 6:
            result = "YES"
            break
        S = S.rstrip("eraser")
    elif S[-7:] == "dreamer":
        if len(S) == 7:
            result = "YES"
            break
        S = S.rstrip("dreamer")
    else:
        break

print(result)

Submission status: Wrong Answer

Solution code:
S = input()

result = "NO"
S = S.rstrip("eraser")

while True:
    if S[-5:] == "dream":
        if len(S) == 5:
            result = "YES"
            break
        S = S.rstrip("dream")
    elif S[-5:] == "erase":
        if len(S) == 5:
            result = "YES"
            break
        S = S.rstrip("erase")
    elif S[-6:] == "eraser":
        if len(S) == 6:
            result = "YES"
            break
        S = S.rstrip("eraser")
        print(S)
    elif S[-7:] == "dreamer":
        if len(S) == 7:
            result = "YES"
            break
        S = S.rstrip("dreamer")
    else:
        break

print(result)

Submission status: Wrong Answer

Solution code:
S = input()

result = "NO"

while True:
    if S[-5:-1] == "dream":
        if len(S) == 5:
            result = "YES"
            break
        S.rstrip("dream")
    elif S[-5:-1] == "erase":
        if len(S) == 5:
            result = "YES"
            break
        S.rstrip("erase")
    elif S[-6:-1] == "eraser":
        if len(S) == 6:
            result = "YES"
            break
        S.rstrip("eraser")
    elif S[-7:-1] == "dreamer":
        if len(S) == 7:
            result = "YES"
            break
        S.rstrip("dreamer")
    else:
        break

print(result)

Submission status: Wrong Answer

Solution code:
print('YES' if len(input().replace('dreamer','').replace('dream','').replace('eraser','').replace('erase',''))==0 else 'NO')

Submission status: Wrong Answer

Solution code:
print('YES' if len(input()[::-1].replace('maerd','').replace('remaerd','').replace('esare','').replace('resare',''))==0 else 'NO')

Submission status: Wrong Answer

Solution code:
s =input()
s = s[::-1]
t = ['dream','dreamer','erase','eraser']

for i in range(len(t)):
    t[i]=t[i][::-1]

while s != '':
    for j in range(len (t)):
        if s[0:len(t[j])]==t[j]:
            s = s[len(t[j]):]
            break
    else:
        print('No')
        break
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
s =input()
s = s[::-1]
t = ['dream','dreamer','erase','eraser']

print(s[:4])
print(len(t))

for i in range(len(t)):
    t[i]=t[i][::-1]

while s != '':
    for j in range(len (t)):
        if s[0:len(t[j])]==t[j]:
            s = s[len(t[j]):]
            break
    else:
        print('No')
        break
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
S = input()[::-1]
T = "dummy"
words = ["maerd", "remaerd", "esare", "resare"]
while True:
    for i in range(len(words)):
        if S[0:len(words[i])] == words[i]:
            S = S.replace(S[0:len(words[i])], "")
    if S == "":
        print("YES")
        break
    elif T == S:
        print("NO")
        break
    else:
        T = S

Submission status: Wrong Answer

Solution code:
S = input()[::-1]
T = "dummy"
words = ["maerd", "remaerd", "esare", "resare"]
while True:
    for i in range(len(words)):
        if S[0:len(words[i])] == words[i]:
            S = S.replace(S[0:len(words[i])], "")
    if len(S) == 0:
        print("YES")
        break
    elif T == S:
        print("NO")
        break
    else:
        T = S

Submission status: Wrong Answer

Solution code:
S=str(input())
w=["dream", "dreamer", "erase", "eraser" ]
rw=[]

rs = S[::-1]
for i in w:
    rw.append(i[::-1])


res=False
while len(rs)>0:
    for i in rw:
        if i == rs[0:len(i)]:
            res=True
            rs=rs[len(i):]
            continue

    break

if res==True:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
s = input()
l = (len(s))
t = ''
u = ['dream', 'dreamer', 'erase', 'eraser'] 

while s != '':
    if s[-1]  == 'r':
        now = s[-7:]
        #print(now)
        if now == 'dreamer':
            #print(now)
            s = s[:len(s)-7]
        elif now[-6:] == 'eraser':
            #print(now)
            s = s[:len(s)-6]
        else:
            print('NO')
            exit()
    else:
        now = s[-5:]
        #print(now)
        if now in u:
            print(now)
            s = s[:len(s)-5]
        else:
            print('NO')
            exit()

print('YES')

Submission status: Wrong Answer

Solution code:
s = input()
l = (len(s))
t = ''
u = ['dream', 'dreamer', 'erase', 'eraser'] 

while s != '':
    if s[-1]  == 'r':
        now = s[-7:]
        #print(now)
        if now == 'dreamer':
            s = s[:len(s)-7]
        elif now[-6] == 'eraser':
            s = s[:len(s)-6]
        else:
            print('NO')
            exit()
    else:
        now = s[-5:]
        #print(now)
        if now in u:
            s = s[:len(s)-5]
        else:
            print('NO')
            exit()

print('YES')

Submission status: Wrong Answer

Solution code:
s = input()
l = (len(s))
t = ''
u = ['dream', 'dreamer', 'erase', 'eraser'] 

while s != '':
    if s[-1]  == 'r':
        now = s[-6:]
        #print(now)
        if now in u:
            s = s[:len(s)-6]
        else:
            print('NO')
            exit()
    else:
        now = s[-5:]
        #print(now)
        if now in u:
            s = s[:len(s)-5]
        else:
            print('NO')
            exit()

print('YES')

Submission status: Wrong Answer

Solution code:
s = input()

if len(s) < 5:
    print("NO")
    exit()

while len(s) >= 5:
    if s[-5:] == "dream":
        s = s[:-5]
    elif s[-5:] == "dreamer":
        s = s[:-7]
    elif s[-5:] == "erase":
        s = s[:-5]
    elif s[-6:] == "eraser":
        s = s[:-6]
    else:
        print("NO")
        exit()

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

Submission status: Wrong Answer

Solution code:
s = input()

if len(s) < 5:
    print("No")
    exit()

while len(s) >= 5:
    if s[-5:] == "dream":
        s = s[:-5]
    elif s[-5:] == "dreamer":
        s = s[:-7]
    elif s[-5:] == "erase":
        s = s[:-5]
    elif s[-6:] == "eraser":
        s = s[:-6]
    else:
        print("No")
        exit()

if len(s) > 0:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
S=input()

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

for i in list:
    if S.find(i) != -1:
        S =S.replace(i,'')
if len(S) == 0:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
S = input()
index = len(S)

ansB = True

while True:
    if index == 0:
        break
    elif index < 0:
        ansB = False
        break

    if S[index - 5: index] == 'dream' or S[index - 5: index] == 'erase':
        index -= 5
    elif S[index - 6: index] == 'dreamer' or S[index - 6: index] == 'eraser':
        index -= 6
    else:
        ansB = False
        break

if ansB:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
S = str(input())
words = ["dream", "dreamer", "erase", "eraser"]

checker = True
while checker == True:
    if S == "":
        checker = False
    elif S[0] == "d":
        if S[0:7] == "dreamer":
            if len(S) >= 7:
                S = S[7:]
            else:
                checker = False
        elif S[0:5] == "dream":
            if len(S) >= 5:
                S = S[5:]
            else:
                checker = False
        else:
            continue
    elif S[0] == "e":
        if S[0:6] == "eraser":
            if len(S) >= 6:
                S = S[6:]
            else:
                checker = False
        elif S[0:5] == "erase":
            if len(S) >= 5:
                S = S[5:]
            else:
                checker = False
    else:
        checker = False

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

Submission status: Wrong Answer

Solution code:
S = str(input())
i = 0
count = 0
a = ["dream","dreamer","erase","eraser"]

if S in a:
  print("YES")
  quit()


while i < len(S) - 7:
  if S[i] == "d":
    if S[i: i+6] == "dreamd":
      i += 5
    elif S[i:i+8] == "dreamera":
      i += 7
    else:
      count += 1
      break
  elif S[i] == "e":
    if (S[i:i+6] == "erasee") or (S[i:i+6] == "erased"):
      i += 5
    elif (S[i:i+7] == "erasere") or (S[i:i+7] == "eraserd"):
      i += 6
    else:
      count += 1
      break
  else:
    count += 1
    break
      
S2 = S[::-1]
#print(count)
if count == 0:
  if (S2[0:5] == "maerd") or (S2[0:7] == "remaerd") or (S2[0:5] == "esare") or (S2[0:6] == "resare"): 
    print("YES")
    quit()
  
print("NO")

Submission status: Wrong Answer

Solution code:
import subprocess
import gzip, base64, os
import stat

gz = b'H4sIAAeyaV0C/+19e3wTVdrwJOkl3JqiiAVRAgYsIr1wbfGWUgITCKXSUvGCQ5qkNJIm2WQCBVFx2/oSIsrrui7u1d1v1/XV/a2u6+sHrstFhKK7KsqKuCyCrOCEitQbFG/5znPOmeTMZCbCqt9fBpqT55nnei7PuczMOXc6XLOMBgMnf4zcNRxA7gvtGLZTfJUnTYJwVVw/9D2SG8EVIDifobNzdkXaR0XLqZnSmdBfHsg1UvlGuyIdQenk1MCk+Rz7sSvSPzRxipTjrGk+sHX/YoLdv3iJIt1mIvgNBUo+I+Xro3x9lF5OOSOnSGX/8uhfI8U3Ur/kdCalm8nQw6f+qOiF3+brqLzr7Ip0NaVbreK7DvEVcGf/KabpAqpPL19Kqf1yKpdDecDfPHVyecA7IeAPxtontFdNnTB1clk0VDYR21RMaWfXLVTkYwm1eQitA/j6wEcW/Pb5ER88XnZR9K57zsz7JCndDtcqmHIb3FK/xD1qpgFwE9HfVPTX/64Nwi88f915b1tq99ouz9B7brB/OOFD4ZYi6/KKUscbriEbB9b+ckR400rnsmf08uEYMuw8DbzJoI0vTtcM5WekDv4pTlvOo3na+CYd/DEd/CYd+S069Id18BX52vgZOvQFOvRndOgn6eTPBzr5nNKRM19Hzo908uEtHfwBHb3n6/g1Woe+VIe+T6defapjz0aTNv5xHfxzOvLv0JHv18m3i3T8Gq7jF6ej9xOd8grryA/pyBmlo3ePTj506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65pcFwqSg+bO+snFmRXkyLFzeTT0P+KZeBY8k+FB5LOilB++lU2Zezb5A+fpTWuJBT1iKDKNPifsCTjn1DVUCEQsPnGvYZqA/jscjpmNnoALjmObKMjkcCAbulwN/wOOaNgTiEYQk9cxrSUUWeGOeJ2NgqMljLnD8xtqhLM2TjZsSjjiD4oaZlGDohFtfgdh/FqTplGTpggCfSqbVLQp+NsToIdCuqoEwR/CNzngqMNzeRT2LOjVjxqfDYvq6eezYNF44PrruTKPdX89bbXShYZzzKWGc8+lhnPPpYb/KJcaziGXGs4pl5rOMZeazj2Xms7WeE9EjIqxlpYyDycIc2oXCC5nQ6MgcJkTXgWxTfDASa5RTgMlCN6QsDQQanYHBC9qvFHBHWvnPCHoBUSft2xqddVEbSIhc79PQBkfWcmRe4beWFvbSsTCQELmNiElFYRZC2rmOQRH3Uw4pxZbTn9Tr+fPmtXgaBQaa2a4HEChEOFVIvB5jpww84a6mnnOWg5uMMo49dGhdjt7aiM9D9ITjWFvuDTXOR4dqpKqfSStWvXXH9ULZ+WqRcNBmmqc4rhOtRrm7Ex6iR5z+XWH8CoEwXmXNI+0TwNVqsUHd6rUqc/eVFuTdRCp2pPMKZ9q1v/gJF6VvXCeaFb2aJ3UqzIq52nK8wX8XpQQi/q82af3KiWRs0xVJuQ4j1ldyXWPXM6qLFpntmoQaZ++rC4TZJXccLMOLM5yEP1X5zE9cVct1hsNCa2oHwj42DZKO/Nv8URnZR2vlg+KzapfipOStZpk7prbHI0yZZU+vFot6OzO7LXbmQNqs08a1mw1WccOZwtRHsWsJUV50rdSgub54PgIbqUkci6vRkv7z06xVrViX6hFHXTSB3Yr7cV9yH92nLVKJ34DMavCnPXx0RqxPNcZ3CpyH36YRut87ewC/hbOlVYbi0K2CqU4yRldo8crq483z+4w5bOzs/ODHo6tkVHqk8K18lI+D1zjGntEtaqWwtHQJNz8P3yeirTThwAA'
bin = gzip.decompress(base64.b64decode(gz))
p = os.path.dirname(__file__)
pymain = os.path.join(p, "a.out")
with open(pymain, "wb") as f:
    f.write(bin)
os.chmod(pymain, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
if p == "":
    pymain = "./" + pymain
subprocess.call(pymain)


# compiled by pythran
'''
#pythran export main2()
def main2():
    s = open('/dev/stdin').readline().replace('eraser', '').replace('dreamer', '').replace('dream', '').replace('erase', '')
    if s == '\n':
        print('YES')
    else:
        print('NO')
'''