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

Solution (Python):
S=input()
while S!="":
    if S[-1]=="m":
        if S[-5]=="d" and S[-4]=="r" and S[-3]=="e" and S[-2]=="a":
            S=S[:-5]
            continue
    elif S[-1]=="e":
        if S[-5]=="e" and S[-4]=="r" and S[-3]=="a" and S[-2]=="s":
            S=S[:-5]
            continue
    elif S[-2]=="e" and S[-1]=="r":
        if S[-3]=="m":
            if S[-7]=="d" and S[-6]=="r" and S[-5]=="e" and S[-4]=="a":
                S=S[:-7]
                continue
        elif S[-3]=="s":
            if S[-6]=="e" and S[-5]=="r" and S[-4]=="a":
                S=S[:-6]
                continue
    print("NO")
    break
else:
    print("YES")

Solution (Python):
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')

Solution (Python):
dest = input().rstrip("\n")

suffixes = ["dream", "dreamer", "erase", "eraser"]
cut_lens = [-5, -7, -5, -6]

while True:
    for suffix, cut_len in zip(suffixes, cut_lens):
        if dest.endswith(suffix):
            dest = dest[:cut_len]
            break
    else:
        break

print("YES" if not dest else "NO")

Solution (Python):
s = input()[::-1]
words = ["dream", "dreamer", "erase", "eraser"]
while True:
    match = False
    for w in words:
        if s.startswith(w[::-1]):
            s = s[len(w)::]
            match = True
    if match == False:
        break
print("NO" if len(s) else "YES")

Solution (Python):
S = input()

result = "NO"

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

print(result)

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

Solution (Python):
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')

Solution (Python):
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:
    resin = False
    for i in rw:
        if i == rs[0:len(i)]:
            resin=True
            break

    if resin == True:
        rs=rs[len(i):]
        res=True
        continue
    else:
        res=False
        break
        

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

Solution (Python):
S=''.join(list(reversed(str(input()))))
words=["maerd","remaerd","esare","resare"]
flag = False
while(True):
    if(len(S) == 0):
        print("YES")
        break
    elif(S[0:len(words[0])] == words[0]):
        S = S[len(words[0]):]
    elif(S[0:len(words[1])] == words[1]):
        S = S[len(words[1]):]
    elif(S[0:len(words[2])] == words[2]):
        S = S[len(words[2]):]
    elif(S[0:len(words[3])] == words[3]):
        S = S[len(words[3]):]
    else:
        print("NO")
        break

Solution (Python):
S = input()
S = S[::-1]
li = ['dream', 'dreamer', 'erase', 'eraser']
for i in range(len(li)):
    li[i] = li[i][::-1]

i = 0
can = True
while i < len(S):
    can2 = False
    
    for j in range(4):
        d = li[j]
        
        
        
        if S[i:(i+len(d))] == d:
            can2 = True
            i += len(d)
            
            break
        

    if can2 == False:
        
        can = False
        break

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

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

while s != '':
    if s[-1]  == 'r':
        now = s[-7:]
        
        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:]
        
        if now in u:
            
            s = s[:len(s)-5]
        else:
            print('NO')
            exit()

print('YES')

Solution (Python):
s = input()

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

while len(s) >= 5:
    if s[-5:] == "dream":
        s = s[:-5]
    elif s[-7:] == "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")

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

Solution (Python):
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] == 'eraser':
        index -= 6
    elif S[index - 7: index] == 'dreamer':
        index -= 7
    else:
        ansB = False
        break

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

Solution (Python):
from sys import exit
s = input()[::-1]
while True:
  if s == '':
    print('YES')
    exit()
  for w in ['maerd', 'remaerd', 'esare', 'resare']:
    if s.startswith(w):
      s = s[len(w):]
      break
  else:
    print('NO')
    exit()

Solution (Python):
from sys import exit
s = input()
ts = ['']
while True:
  nts= []
  for t in ts:
    for w in ['dreamer', 'eraser', 'dream', 'erase']:
      tw = t + w
      if s == tw:
        print('YES')
        exit()
      if s.startswith(tw):
        nts.append(tw)
  if len(nts) == 0:
    print('NO')
    exit()
  ts = nts

Solution (Python):
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 += 5
    elif S[i:i+8] == "dreamerd":
      i += 7
    elif S[i:i+8] == "dreamere":
      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]

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")

Solution (Python):
import re
S = input()
if re.fullmatch('(dream|dreamer|erase|eraser)+', S):
  print('YES')
else:
  print('NO')

Solution (Python):
import subprocess
import gzip, base64, os
import stat

gz = b'H4sIAOWyaV0C/+19e3wTVdrwJOkl3JoiiAVRAgYsIr1wbfGWUgITCKXSUkHFIU1SGk2TbDKBgqi4bX0JEWVd19W9uvu9u+vr7m9lXV8/cF0uIhTdVVFWxGURZBUnVKTeoHgh33nOOZOcmcxEWPX7y0Bz8jzzXM/lOZeZOecuh2u20WDg5I+Ru5YDyH2RHcN2iq/ypEkQrorrh75HcSO5AgTnM3R2zq5I+6hoOTVTOhP6ywO5RirfaFekIymdnBqYNJ9jP3ZF+ocmTpFynDXNB7YeWEqwB5YuU6TbTQS/sUDJZ6R8fZSvj9LLKWfkFKnsXx79a6T4RuqXnM6idLMYevjUvyt64bf5eirversiXUPp1qj4rkd8Bdy5f4ppupDq08uXUmq/nMrlUB7wN0+bUh7wTgz4g7H2ie1V0yZOm1IWDZVNwjYVU9o5dYsU+VhCbR5K6wBcX7L/nQPcvwYOmzFj0OrH+v3AdXrNipvgWgVTboNb6pe5R88yAG4S+puG/vrfvVH4ueevu+5rS+1Z1+UZdu8S+4cTPxRuKbKuq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URzFrSVGe9K2UoHk+OD6CWymJnMur0dL+s1OsVa3YF2pRB530gd1Ke3Ef8p8dZ63Sid9AzKow53x8tEYsz3UGt4rchx+m0TpfO7uAv4FzpdXGopCtQilOckbX6PHK6uPNsztM+ezs7Pygh2NrZJT6pHCtvJTPA9e4xh5RraqlcDQ0CTf/D0j9VCzThwAA'
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)



'''

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