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:
# -*- coding: utf-8 -*-

s = list(input())

for i in s:

    if (s[:7].reverse() == ["r", "e", "m", "a", "e", "r", "d"]):
        del s[:7]
    elif(s[:6].reverse() == ["r", "e", "s", "a", "r", "e"]):
        del s[:6]
    elif(s[:5].reverse() == ["e", "s", "a", "r", "e"]):
        del s[:5]
    elif(s[:5].reverse() == ["m", "a", "e", "r", "d"]):
            del s[:5]
    else:
        break

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

s = list(input())

for i in s:

    if (s[-7:].reverse() == ["r", "e", "m", "a", "e", "r", "d"]):
        del s[-7:]
    elif(s[-6:].reverse() == ["r", "e", "s", "a", "r", "e"]):
        del s[-6:]
    elif(s[-5:].reverse() == ["e", "s", "a", "r", "e"]):
        del s[-5:]
    elif(s[-5:].reverse() == ["m", "a", "e", "r", "d"]):
            del s[-5:]
    else:
        break

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

s = list(input())

for i in s:
    
    if (s[-7:] == ["d", "r", "e", "a", "m", "e", "r"]):
        del s[-7:]
    elif(s[-6:] == ["e", "r", "a", "s", "e", "r"]):
        del s[-6:]
    elif(s[-5:] == ["e", "r", "a", "s", "e"]):
        del s[-5:]
    elif(s[-5:] == ["d", "r", "e", "a", "m"]):
            del s[-5:]
    else:
        break

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

s = list(input())

for i in s:
    if(s[-5:] == ["d", "r", "e", "a", "m"]):
        del s[-5:]
    elif (s[-7:] == ["d", "r", "e", "a", "m", "e", "r"]):
        del s[-7:]
    elif(s[-5:] == ["e", "r", "a", "s", "e"]):
        del s[-5:]
    elif(s[-6:] == ["e", "r", "a",  "s", "e", "r"]):
        del s[-6:]
    else:
        break

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque

def main():
    input = sys.stdin.readline
    S = str(input().strip())
    stock = ['dream', 'dreamer', 'erase', 'eraser']

    q = deque()
    q.append(S)
    while len(q) > 0:
        s = q.popleft()
        if len(s) == 0:
            return 'YES'

        if s[:5] in stock:
            q.append(s[5:])
        if s[:6] in stock:
            q.append(s[6:])

    return 'NO'


if __name__ == '__main__':
    print(main())

Submission status: Wrong Answer

Solution code:
import sys

def main():
    input = sys.stdin.readline
    S = str(input().strip())
    stock = ['dream', 'dreamer', 'erase', 'eraser']

    while len(S) > 0:
        if S[:5] in stock:
            S = S[5:]
        elif S[:6] in stock:
            S = S[6:]
        else:
            return 'NO'

    return 'YES'


if __name__ == '__main__':
    print(main())

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
S = S[::-1]
divide = ["dream", "dreamer", "erase", "eraser"]
for k in range(len(divide)):
  divide[k] = divide[k][::-1]
is_divide = False
for i in range(len(S)):
  for j in range(len(divide)):
    if S[i:len(divide[j])+1] == divide[j]:
      is_divide = True
      i += len(divide[j])

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

Submission status: Wrong Answer

Solution code:
S = input()
T = ['dream', 'dreamer', 'erase','eraser']

n = len(S)
r = 0
print(n)
while(n > 0):
  for t in T:
    s = n - len(t)
    if(t == S[s:n]):
      r = 1
      n = s
      break
  if(r == 0):
    break
if r == 0:
  print("NO")
else:
  print("YES")

Submission status: Wrong Answer

Solution code:
S = input()
T = ['dream', 'dreamer', 'erase','eraser']

n = len(S)
r = 0
print(n)
while(n > 0):
  for t in T:
    s = n - len(t)
    if(t == S[s:n]):
      r = 1
      n = s
      break
  if(r == 0):
    break
if r == 0:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
s = input()
s_rev = s[::-1]
while s_rev[0:1]:
    if s_rev.startswith("maerd"):
        s_rev = s_rev[5::1]
    elif s_rev.startswith("remaerd"):
        s_rev = s_rev[7::1]
    elif s_rev.startswith("esare"):
        s_rev = s_rev[5::1]
    elif s_rev.startswith("resare"):
        s_rev = s_rev[6::1]
    else:
        print("NO")
        break
if s_rev[0:1]==False:
    print("YES")

Submission status: Wrong Answer

Solution code:
#049 C

S = input()
A = 'dream'
B = 'dreamer'
C = 'erase'
D = 'eraser'
S=S[::-1]
A=A[::-1]
B=B[::-1]
C=C[::-1]
D=D[::-1]

tmp =""
for i in S:
    tmp +=i
#     print(tmp)
    for j in [A,B,C,D]:
        if tmp == j:
            S=S.replace(tmp,"")
#             print(S)
            tmp=""
if len(S)==0:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
S = input()
S = S[::-1]
N = ["dream", "dreamer", "erase", "eraser"]
bool = True

while bool:
  if len(S) == 0:
    break
 
  bool = False
  for n in N:
    n = n[::-1]
    if S.startswith(n):
      S = S.replace(n, "")
      bool = True
      break
  

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

Submission status: Wrong Answer

Solution code:
S = str(input())
while "eraser" in S:     
    S=S.replace("eraser","")
while "dreamer" in S: 
    S=S.replace("dreamer","")
while "dream" in S: 
    S=S.replace("dream","")
while "erase" in S: 
    S=S.replace("erase","")
if len(S) == 0:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

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

Submission status: Wrong Answer

Solution code:
from __future__ import print_function

print("YES") if raw_input().replace("eraser", "").replace("dreamer", "").replace("erase", "").replace("dream", "") == "" else print("NO")

Submission status: Wrong Answer

Solution code:
S = input().rstrip()
S = S[::-1]
daydream = ['maerd', 'remaerd', 'esare', 'resare']
nextIndex = 0
flg = True
for i in range(10**5//5):
    if nextIndex == len(S):
        break
    for j in daydream:
        if j == S[nextIndex: nextIndex+len(j)]:
            nextIndex += len(j)
            flg = True
            break
        flg = False
    if flg:
        break
print("YES" if flg else "NO")

Submission status: Wrong Answer

Solution code:
S = input().rstrip()
S = S[::-1]
daydream = ['maerd', 'remaerd', 'esare', 'resare']
nextIndex = 0
answer = "YES"
for i in range(10**5//2):
    if nextIndex == len(S):
        break
    tmp = S[nextIndex: nextIndex+5]
    if tmp in daydream:
        nextIndex += 5
        continue
    tmp = S[nextIndex: nextIndex+6]
    if tmp in daydream:
        nextIndex += 6
        continue
    answer = "NO"
    break
print(answer)

Submission status: Wrong Answer

Solution code:
S = input().rstrip()
S = S[::-1]
daydream = ['maerd', 'remaerd', 'esare', 'resare']
nextIndex = 0
answer = "YES"
for i in range(10**5//5):
    if nextIndex == len(S):
        break
    tmp = S[nextIndex: nextIndex+5]
    if tmp in daydream:
        nextIndex += 5
        continue
    tmp = S[nextIndex: nextIndex+6]
    if tmp in daydream:
        nextIndex += 6
        continue
    answer = "NO"
    break
print(answer)

Submission status: Wrong Answer

Solution code:
S = input().rstrip()
S = S[::-1]
daydream = ['maerd', 'remaerd', 'esare', 'resare']
nextIndex = 0
answer = "YES"
for i in range(10**5//5):
    tmp = S[nextIndex: nextIndex+5]
    if tmp in daydream:
        nextIndex += 5
        break
    tmp = S[nextIndex: nextIndex+6]
    if tmp in daydream:
        nextIndex += 6
        break
    answer = "NO"
    break
print(answer)

Submission status: Wrong Answer

Solution code:
import re
s = (re.sub("eraser|erase|dreamer|dream", "", str(input())))
print("YES") if  s == "" else print("NO")

Submission status: Wrong Answer

Solution code:
import re
s = (re.sub("dreamer|eraser|erase|dream", "", str(input())))
print("YES") if  s == "" else print("NO")

Submission status: Wrong Answer

Solution code:
S = input()
T = ['dream', 'dreamer', 'erase','eraser']

n = len(S)
r = 'No'
while n != 0:
  for t in T:
    e = n - len(t)
    if(e < 0):
      r = 'No'
      continue
    if(t == S[e:n]):
      r = 'Yes'
      n = e
      break
  if(r == 'No'):
    break

print(r)

Submission status: Wrong Answer

Solution code:
S = input()
T = ['dream', 'dreamer', 'erase','eraser']
n = len(S)
r = 'No'
while n != 0:
  for t in T:
    e = n - len(t)
    if(e < 0):
      r = 'No'
      continue
    if(t == S[e:n]):
      r = 'Yes'
      n = e
      break
  if(r == 'No'):
    break
print(r)

Submission status: Wrong Answer

Solution code:
S = input()
N = ["dream", "dreamer", "erase", "eraser"]
bool = True

while bool:
  if len(S) == 0:
    break
 
  bool = False
  for n in N:
    if S.endswith(n):
      S = S.replace(n, "")
      bool = True
      break
  

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

Submission status: Wrong Answer

Solution code:
S = input()
N = ["dream", "dreamer", "erase", "eraser"]
bool = True


while bool:
  if len(S) == 0:
    break
 
  bool = False
  for n in N:
    if S.endswith(n):
      S = S.rstrip(n)
      bool = True
      break
  

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

Submission status: Wrong Answer

Solution code:
S = input()
N = ["dreamer", "dream", "eraser", "erase"]
bool = True


while bool:
  if len(S) == 0:
    break
 
  bool = False
  for n in N:
    if S.endswith(n):
      S = S.rstrip(n)
      bool = True
      break
  

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

Submission status: Wrong Answer

Solution code:
S = input()
N = ["dreamer", "dream", "eraser", "erase"]
bool = True

while bool:
  bool = False
  for n in N:
    if S.endswith(n):
      S = S.rstrip(n)
      bool = True
      break
  
  if len(S) == 0:
    break

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from functools import reduce

def main():
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    # 1e10

    # 初期値用:十分小さい数(-100億)
    # -1e10
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]
    T = [
        ['d','r','e','a','m'],
        ['d','r','e','a','m','e','r'],
        ['e','r','a','s','e'],
        ['e','r','a','s','e','r']
    ]
    S = list(_ for _ in input())
    S.reverse()

    for i in range(4):
        T[i].reverse()
    while len(S)>0:        
        if(S[0:len(T[0])] == T[0]):
            for i in range(len(T[0])):
                S.pop()
        elif(S[0:len(T[1])] == T[1]):
            for i in range(len(T[1])):
                S.pop()
        elif(S[0:len(T[2])] == T[2]):
            for i in range(len(T[2])):
                S.pop()
        elif(S[0:len(T[3])] == T[3]):
            for i in range(len(T[3])):
                S.pop()
        else:
            print('NO')
            break
        
    if(len(S) ==0):
        print('YES')

    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from functools import reduce

def main():
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    # 1e10

    # 初期値用:十分小さい数(-100億)
    # -1e10
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]
    T = [
        ['d','r','e','a','m'],
        ['d','r','e','a','m','e','r'],
        ['e','r','a','s','e'],
        ['e','r','a','s','e','r']
    ]
    S = list(_ for _ in input())
    S.reverse()

    for i in range(4):
        T[i].reverse()
    while len(S)>0:        
        if(S[0:len(T[0])] == T[0]):
            for i in range(len(T[0])):
                S.pop()
        elif(S[0:len(T[1])] == T[1]):
            for i in range(len(T[1])):
                S.pop()
        elif(S[0:len(T[2])] == T[2]):
            for i in range(len(T[2])):
                S.pop()
        elif(S[0:len(T[3])] == T[3]):
            for i in range(len(T[2])):
                S.pop()
        else:
            print('NO')
            break
        
    if(len(S) ==0):
        print('YES')

    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = list(input())
while s:
    if ''.join(s[:5]) == 'erase' or ''.join(s[:5]) == 'dream':
        for i in range(5):
            s.pop(0)
    elif ''.join(s[:6]) == 'eraser':
        for i in range(6):
            s.pop(0)
    elif ''.join(s[:7]) == 'dreamer':
        for i in range(7):
            s.pop(0)
    else:
        print('NO')
        exit()
    
    if len(s) == 0:
        print('YES')
        exit()

Submission status: Wrong Answer

Solution code:
s = list(input())
while s:
    if ''.join(s[:5]) == 'erase':
        for i in range(5):
            s.pop(0)
        if len(s) >= 1:
            if s[0] == 'r':
                s.pop(0)
    elif ''.join(s[:5]) == 'dream':
        for i in range(5):
            s.pop(0)          
        if len(s) >= 2:
            if ''.join(s[:2]) == 'er':
                for i in range(2):
                    s.pop(0)
    else:
        print('NO')
        exit()
    
    if len(s) == 0:
        print('YES')
        exit()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

s = list(input())

s.reverse()
s = "".join(s)

s = s.replace("maerd","A")
s = s.replace("remaerd","B")
s = s.replace("esare","C")
s = s.replace("resare","D")
s = s.replace("AC","")
s = s.replace("DA","")

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

s = list(input())

s.reverse()
s = "".join(s)

s = s.replace("maerdesare","")
s = s.replace("resaremaerd","")

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

Submission status: Wrong Answer

Solution code:
s=input()
while len(s)>4:
  if s[-5:]=='dream':
    s=s[:-5]
  elif s[-5:]=='erase':
    s=s[:-5]
  elif len(s)<6:
    print('NO')
    exit()
  elif s[-6:]=='eraser':
    s=s[:-6]
  elif len(s)<7:
    print('NO')
    exit()
  elif s[:-7]=='dreamer':
    s=s[:-7]
  else:
    print('NO')
    exit()
print('YES')

Submission status: Wrong Answer

Solution code:
S = input()
S = S[::-1]
_ = ["dream", "dreamer", "erase", "eraser"]
_ = [_[i][::-1] for i in range(4)]
i = 0
while i < len(S):
    can = False
    for k in _:
        if S[i:i + len(k)] == k:
            can = True
            i += len(k)
    if not can:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
S = input()
ans = 'NO'

while True:
    if S[-7:] == 'dreamer':
        S = S[:-7]
        if S == '':
            ans = 'YES'
            break
    elif S[-6:] == 'eraser':
        S = S[:-6]
        if S == '':
            ans = 'YES'
            break
    if S[-5:] == 'dream' or S[-5:] == 'erase':
        S = S[:-5]
        if S == '':
            ans = 'YES'
            break
    else:
        break

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
ans = 'NO'

while True:
    if S[-7:] == 'dreamer':
        S = S[:-7]
        if S == None:
            ans = 'YES'
            break
    elif S[-6:] == 'eraser':
        S = S[:-6]
        if S == None:
            ans = 'YES'
            break
    if S[-5:] == 'dream' or S[-5:] == 'erase':
        S = S[:-5]
        if S == '':
            ans = 'YES'
            break
    else:
        break

print(ans)

Submission status: Wrong Answer

Solution code:
words = ['dream', 'dreamer', 'erase', 'eraser']
s = input()
for word in words:
  s = s.replace(word, '*')
s = s.replace('*', '')
if len(s) == 0:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
words = ['dream', 'dreamer', 'erase', 'eraser']
s = input()
for word in words:
  s = s.replace(word, '')
if len(s) == 0:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
S = input()
word_list = ['dream', 'dreamer', 'erase', 'eraser']
ans = 'NO'
for t1 in word_list:
    for t2 in word_list:
        T = t1 + t2
        if S == T:
            ans = 'YES'

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

a = ["dream","dreamer","erase","eraser"]
x = []

for i in range(4):
    for n in range(4):
        c = a[i] + a[n]
        x.append(c)
        
d = 0
for n in range(len(x)):
    if S == x[n]:
        pass
        
    else:
        d += 1  
        
print('No' if d == 16 else 'Yes')

Submission status: Wrong Answer

Solution code:
a=("dream","erase");ans="YES"
s=input()
while s!="":
  if s[:7]=="dreamer":s=s[7:]
  elif s[:6]=="eraser":s=s[6:]
  elif s[:5]in a:s=s[5:]
  else:ans="NO";break
print(ans)

Submission status: Wrong Answer

Solution code:
t = input()
t = t[::-1]
dream = 'dream'
dreamer = 'dreamer'
erase = 'erase'
eraser = 'eraser'
dream = dream[::-1]
dreamer = dreamer[::-1]
erase = erase[::-1]
eraser = eraser[::-1]
t = t.replace(dreamer,'').replace(dream,'').replace(eraser,'').replace(erase,'')
if t == '':
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
def dream(s):
  s=s.replace("maerd","")
  s=s.replace("resare","")
  s=s.replace("esare","")
  s=s.replace("remaerd","")
 
  if s=="":
    return "YES"
  else:
    return "NO"
a=input()
a=a[::-1]
print(dream(a))

Submission status: Wrong Answer

Solution code:
def dream(s):
  ss=s
  s=s.replace("maerd","")
  s=s.replace("resare","")
  s=s.replace("esare","")
  s=s.replace("remaerd","")
 
  if s=="":
    return "YES"
  else:
    return "NO"
s=input()
s=s[::-1]
print(dream(s))

Submission status: Wrong Answer

Solution code:
def dream(s):
  ss=s
  s=s.replace("maerd","")
  s=s.replace("resare","")
  s=s.replace("esare","")
  s=s.replace("remserd","")
 
  if s=="":
    return "YES"
  else:
    return "NO"
s=input()
s=s[::-1]
print(dream(s))

Submission status: Wrong Answer

Solution code:
def dream(s):
  ss=s
  s=s.replace("maerd","")
  s=s.replace("resare","")
  s=s.replace("esare","")
  s=s.replace("remserd","")
  if s==ss :
    return "NO"
  elif s=="":
    return "YES"
  else: 
    dream(s)
s=input()
s=s[::-1]
print(dream(s))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for x in list:
    for i in range(10**5):
        s = s.replace(x, '')

if s != '':
    print('NO')
else:
    print('YES')

Submission status: Wrong Answer

Solution code:
s = list(input())
s.reverse()
s = "".join(s)
before_s = s
while(True):
    if s[:5]=="maerd" or s[:5] =="esare":
        s = s[5:]
    elif s[:7]=="remaerd" :
        s = s[7:]
    elif s[:6] == "resare":
        s = s[6:]
    if s == "":
        ans = "Yes"
        break
    if s == before_s:
        ans ="No"
        break
print(ans)

Submission status: Wrong Answer

Solution code:
s=input()

s=s[::-1]

X=['maerd','remaerd','esare','resare']
ans='Yes'
i=0
while i<=len(s)-5:
    if s[i:i+5] in X:
        i+=5
    else:
        if s[i:i+6] in X:
            i+=6
        else:
            if s[i:i+7]  in X:
                i+=7
            else:
                ans='No'
                break

print(ans)

Submission status: Wrong Answer

Solution code:
# coding:utf-8
S = input()
s =len(S)
t=0
n = int(s/5)
f=0
def endcheck(t,s):
  if t==s:
    print("YES")
    f=1
for i in range(n):
  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)
  elif f ==1:
    break
  else:
    print("NO")
    break

Submission status: Wrong Answer

Solution code:
# coding:utf-8
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

Submission status: Wrong Answer

Solution code:
# coding:utf-8
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":
    t += 5
    endcheck(t,S)
  elif S[t:t+7] =="dreamer":
    t += 7
    endcheck(t,S)
  elif S[t:t+5] =="erase":
    t += 5
    endcheck(t,S)
  elif S[t:t+6] =="eraser":
    t += 6
    endcheck(t,S)
  else:
    print("NO")
    break

Submission status: Wrong Answer

Solution code:
#! /usr/bin/python 
# -*- coding: utf-8 -*- 
#===============================================================================
# Date created  : 2019-03-30T11:32:28+09:00
# Date modified : 2019-03-30T11:53:02+09:00
# Author        : awk
# Description   : unanswered
#===============================================================================


S = input()
S = S[::-1] 
n = len(S)
while len(S) != 0:
    tmp = S[:3]
  #  print(tmp)
    if tmp == "resare":
        S = S[6:]
    elif tmp == "remaerd":
        S = S[7:]
    elif tmp == "esare":
        S = S[5:]
    elif tmp == "maerd":
        S = S[5:]
    else:
        print("NO")
        quit()
print("YES")

Submission status: Wrong Answer

Solution code:
#! /usr/bin/python 
# -*- coding: utf-8 -*- 
#===============================================================================
# Date created  : 2019-03-30T11:32:28+09:00
# Date modified : 2019-03-30T11:53:02+09:00
# Author        : awk
# Description   : unanswered
#===============================================================================


S = input()
S = S[::-1] 
n = len(S)
while len(S) != 0:
    tmp = S[:3]
    print(tmp)
    if tmp == "resare":
        S = S[6:]
    elif tmp == "remaerd":
        S = S[7:]
    elif tmp == "esare":
        S = S[5:]
    elif tmp == "maerd":
        S = S[5:]
    else:
        print("NO")
        quit()
print("YES")

Submission status: Wrong Answer

Solution code:
#! /usr/bin/python 
# -*- coding: utf-8 -*- 
#===============================================================================
# Date created  : 2019-03-30T11:32:28+09:00
# Date modified : 2019-03-30T11:51:11+09:00
# Author        : awk
# Description   : unanswered
#===============================================================================


S = input()
S = S[::-1] 
n = len(S)
while len(S) != 0:
    tmp = S[:3]
    if tmp == "res":
        S = S[6:]
    elif tmp == "esa":
        S = S[5:]
    elif tmp == "rem":
        S = S[7:]
    elif tmp == "mae":
        S = S[5:]
    else:
        print("NO")
        quit()
print("YES")

Submission status: Wrong Answer

Solution code:
#! /usr/bin/python 
# -*- coding: utf-8 -*- 
#===============================================================================
# Date created  : 2019-03-30T11:32:28+09:00
# Date modified : 2019-03-30T11:45:31+09:00
# Author        : awk
# Description   : unanswered
#===============================================================================


S = input()
n = len(S)
cnt = 0
tmp = -1
S = S.replace("eraser","") 
S = S.replace("dreamer","")
S = S.replace("dream","")
S = S.replace("erase","")    
if S == '':
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
#! /usr/bin/python 
# -*- coding: utf-8 -*- 
#===============================================================================
# Date created  : 2019-03-30T11:32:28+09:00
# Date modified : 2019-03-30T11:43:34+09:00
# Author        : awk
# Description   : unanswered
#===============================================================================


S = input()
n = len(S)
cnt = 0
tmp = -1
S = S.replace("dreamer","")
S = S.replace("eraser","")    
    

S = S.replace("dream","")
S = S.replace("erase","")    
if S == '':
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
#! /usr/bin/python 
# -*- coding: utf-8 -*- 
#===============================================================================
# Date created  : 2019-03-30T11:32:28+09:00
# Date modified : 2019-03-30T11:42:27+09:00
# Author        : awk
# Description   : unanswered
#===============================================================================


S = input()
n = len(S)
cnt = 0
tmp = -1
while True:
    if len(S.replace("dreamer","",1)) != len(S):
        S = S.replace("dreamer","",1)
        cnt += 1
        continue
    if len(S.replace("eraser","",1)) != len(S) :
        S = S.replace("eraser","",1)    
        cnt += 1
        continue
    break
    

while True:
    if len(S.replace("dream","",1)) != len(S):
        S = S.replace("dream","",1)
        cnt += 1
        continue
    if len( S.replace("erase","",1)) != len(S) :
        S = S.replace("erase","",1)    
        cnt += 1
        continue
    break
if S == '':
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
s = input()
# s = "dreamerase"
L = ["eraser", "dreamer", "erase", "dream"]
i = 0
f = 0
while i < len(s):
    if s[i:i+6] == "eraser" and (len(s) == i+6 or s[i+6:i+8] != "as"):
        i += 6
        break
    elif s[i:i+7] == "dreamer" and (len(s) == i+7 or s[i+7:i+9] != "as"):
        i += 7
        break
    if s[i:i+5] == "erase" or s[i:i+5] == "dream":
        i += 5
        break
    else:
        f = 1
        break

if f == 0:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
s = input()
# s = "dreamerase"
L = ["eraser", "dreamer", "erase", "dream"]
i = 0
f = 0
while i < len(s):
    if s[i:i+6] == "eraser":
        i += 6
        break
    elif s[i:i+7] == "dreamer" and (len(s) == i+7 or s[i+7:i+9] != "as"):
        i += 7
        break
    if s[i:i+5] == "erase" or s[i:i+5] == "dream":
        i += 5
        break
    else:
        f = 1
        break

if f == 0:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
s = input()
# s = "dreamerase"
L = ["eraser", "dreamer", "erase", "dream"]
i = 0
f = 0
while i < len(s):
    if s[i:i+6] == "eraser":
        i += 6
        break
    elif s[i:i+7] == "dreamer" and (len(s) == i+6 or s[i+6:i+8] != "as"):
        i += 7
        break
    if s[i:i+5] == "erase" or s[i:i+5] == "dream":
        i += 5
        break
    else:
        f = 1
        break

if f == 0:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
s = input()
# s = "dreamerase"
L = ["eraser", "dreamer", "erase", "dream"]
i = 0
f = 0
while i < len(s):
    if s[i:i+6] == "eraser":
        i += 6
        break
    elif s[i:i+6] == "dreamer" and (len(s) == i+6 or s[i+6:i+8] != "as"):
        i += 6
        break
    if s[i:i+5] == "erase" or s[i:i+5] == "dream":
        i += 5
        break
    else:
        f = 1
        break

if f == 0:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
s = input()
a = s

for i in range(10**4):
    a = a.replace('erase', '').replace('eraser', '').replace('dreamer', '').replace('dream', '')

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

Submission status: Wrong Answer

Solution code:
s = input()
a = s
li = ['dreamer', 'eraser', 'dream', 'erase']
for i in range(10**4):
    a = a.replace('eraser', '').replace('dreamer', '').replace('dream', '').replace('erase', '')

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

Submission status: Wrong Answer

Solution code:
print("YES")

Submission status: Wrong Answer

Solution code:
s = input()
a = s
li = ['dreamer', 'eraser', 'dream', 'erase']
for i in range(10**5):
    a = a.replace('dreamer', '').replace('eraser', '').replace('dream', '').replace('erase', '')

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

Submission status: Wrong Answer

Solution code:
s = input()
L = ["eraser", "dreamer", "erase", "dream"]
i = 0
f = 0
while i < len(s):
    for l in L:
        if s[i:i+len(l)] == l:
            i += len(l)
            break
    else:
        f = 1
        break

if f == 0:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

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

def check(x):
  if x=='':
    return True
  for t in a:
    if len(x)>=len(t) and x[0:len(t)]==a:
      return check(x[len(t):])
    else:
      return False
if check(s):
  ans='YES'
else:
  ans='NO'
print(ans)