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 subprocess
import gzip, base64, os
import stat

gz = b'H4sIAEgsaV0C/+19e3wURbZ/z+Q1vDIBUSMIDBgxiIQMBEh0lYQw0COTEElAfGAzmUxINJnJb6YnBFeXYBKXcYiyrtd13V1lvbter+7eZb1eF1mFIErQ9YGiyEMFFXSGgOILsgrM75yq6kl1T3cE3fv74/exldScb5+qOnXq1KlHd1etdLjmmE0mQbnMwlUCUm+MKCZ0McObPAkWwAqFAfB3jHChkA50GsdXLBSrwl6WtBJaGF8K/EuFf4VmSheai1XhhYxPCU1cmCbwV7Eq/GqhoAoFwZaIh7LuXkLR3UuWqsLeFIpnZajjmVm8XhavV+FnoWAWVKFSvlT2r4rhVaxcSjib8c3m+PGqOCTX4O/e+Sy/+cWqsJ3xtWviXQPx0oUzv7JYuIDlZ6SXXCa/Eir1MLmhvnp6weSGmkkN9b5Qy6SWwumTphfkBf15U4hMWYx3bvlClR6zmczDmQ3g/XvnH8xMO5g685/F9xSOem7NwO1VD8zEe9NZPKySDl9WXerYAWaTUCC0QtJ4rwj+XQX/nnx36tsDV62Vfud57sW7G+PbV3d4znurcl3bmuuKP5/0uXRTpq05P9fxtqvr8Piu4Q8MLn3owqYNK5y3PN2ffv4BAgzTwTea9fHzTPp4VsKS1NcYA/zpNP10agzwJwV9XDbg/9QAn5Gu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s1d4PTzfXqkzseXaMK8oaZ3rnmyWbzLzi/W6cb1Ckd68+SHJ3q0Gy4xw60JsJNR7OH+XFyV8Idb56cFzugXEcI7entyabctKKv5u0FyYeAa2LgGdzUr/1fJ9U4jzOLAAA='
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():
    stdin = open('/dev/stdin')
    N = int(stdin.readline())
    t0 = 0
    x0 = 0
    y0 = 0
    for _ in range(N):
        t1, x1, y1 = map(int, stdin.readline().split())
        t = t1 - t0
        r = abs(x1 - x0) + abs(y1 - y0)
        if t < r or t & 1 != r & 1:
            print('No')
            return
    print('Yes')
'''

Submission status: Wrong Answer

Solution code:
s = input().replace("eracer", "").replace("erace", "").replace("dreamer", "").replace("dream", "")
if s:
    print("NO")
else:
    print("YES")

Submission status: Wrong Answer

Solution code:
s = input()
d = ['dream', 'dreamer', 'erase', 'eraser']
s = s[::-1]
for i in range(len(d)):
    d[i]= d[i][::-1]
while s != '':
    for j in range(len(d)):
        if s[0:len(d[j])] == d[j]:
            s = s[len(d[j]):]
            break
    else:
        print('No')
        break
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
s = input()
while s != '':
    tmp = s
    s = s[-6:].replace('eraser', '')
    s = s[-5:].replace('erase', '')
    s = s[-7:].replace('dreamer', '')
    s = s[-5:].replace('dream', '')
    if s == '':
        print('YES')
    if tmp == s:
        print('NO')
        break

Submission status: Wrong Answer

Solution code:
s = input()
while s != '':
    tmp = s
    s = s[-5:].replace('dream', '')
    s = s[-7:].replace('dreamer', '')
    s = s[-5:].replace('erase', '')
    s = s[-6:].replace('eraser', '')
    if s == '':
        print('YES')
    if tmp == s:
        print('NO')
        break

Submission status: Wrong Answer

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

while s != '':
    tmp = s
    for word in words:
        s.rstrip(word)
        if s == '':
            print('YES')
    if tmp == s:
        print('NO')
        break

Submission status: Wrong Answer

Solution code:
import math
import numpy as np


#a, b, c, x = map(int, [input() for i in range(4)])
#z = list(map(int, input().split()))
#n, a, b = map(int, input().split())

#print(len(z))
#for i in z:
#    print(i)

#a = sorted(a,reverse = True)
#print(sum(a[::2]) - sum(a[1::2]))
#z = map(int, [input() for i in range(int(n))])

s = input()

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

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

Submission status: Wrong Answer

Solution code:
S = input()

while len(S) > 0:
  if "dreameraser" in S:
    S = S.replace("dreameraser","")
  elif "dreamer" in S:
    S = S.replace("dreamer","")
  elif "dream" in S:
    S = S.replace("dream","")
  elif "eraser" in S:
    S = S.replace("eraser","")
  elif "erase" in S:
    S = S.replace("erase","")
  else:
    break
    
if len(S) == 0:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
S = input()

while len(S) > 0:
  if "dreameraser" in S:
    S = S.replace("dreameraser","")
  elif "dream" in S:
    S = S.replace("dream","")
  elif "dreamer" in S:
    S = S.replace("dreamer","")
  elif "erase" in S:
    S = S.replace("erase","")
  elif "eraser" in S:
    S = S.replace("eraser","")
  else:
    break
    
if len(S) == 0:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
import sys
import re

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')


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

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

Submission status: Wrong Answer

Solution code:
def main():
    s = input()
    while s:
        if s[:7] == 'dreamer':
            s = s[7:]
        elif s[:5] == 'dream':
            s = s[5:]
        elif s[:6] == 'eraser':
            s = s[6:]
        elif s[:5] == 'erase':
            s = s[5:]
        else:
            return 'NO'
    else:
        return 'YES'





print(main())

Submission status: Wrong Answer

Solution code:
import sys
import re
inputs = input().rstrip()
flg = False
lst = ["dream","dreamer","erase","eraser"]

while True:
    bstr = inputs
    for i in range(len(lst)):
        if inputs.endswith(lst[i]):
            inputs = inputs.rstrip(lst[i])
    if inputs == "":
        print("YES")
        exit(0)
    if bstr == inputs:
        print("NO")
        exit(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    S = input()
    
    S = S.split("dreameraser")
    S = "".join(S)
    S = S.split("dreamerase")
    S = "".join(S)
    S = S.split("erasererase")
    S = "".join(S)
    S = S.split("dreamer")
    S = "".join(S)
    S = S.split("eraser")
    S = "".join(S)
    S = S.split("dream")
    S = "".join(S)
    S = S.split("erase")
    S = "".join(S)
    
    S = S.split("aser")
    S = "".join(S)
    
    S = S.split("ase")
    S = "".join(S)
    
    #print(S)
    
    if S == "":
        print("YES")
    else:
        print("NO")
    
if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    S = input()
    
    S = S.split("dreameraser")
    S = "".join(S)
    S = S.split("dreamerase")
    S = "".join(S)
    S = S.split("erasererase")
    S = "".join(S)
    S = S.split("dreamer")
    S = "".join(S)
    S = S.split("eraser")
    S = "".join(S)
    S = S.split("dream")
    S = "".join(S)
    S = S.split("erase")
    S = "".join(S)
    
    #print(S)
    
    if S == "":
        print("YES")
    else:
        print("NO")
    
if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    S = input()
    S = S[::-1]
    
    a = "dreamer"
    a = a[::-1]
    b = "eraser"
    b = b[::-1]
    c = "dream"
    c = c[::-1]
    d = "erase"
    d = d[::-1]
    
    e = "dreamerase"
    e = e[::-1]
    f = "dreameraser"
    f = f[::-1]
    
    S = S.split(f)
    S = "".join(S)
    S = S.split(e)
    S = "".join(S)
    
    S = S.split(a)
    S = "".join(S)
    S = S.split(b)
    S = "".join(S)
    S = S.split(c)
    S = "".join(S)
    S = S.split(d)
    S = "".join(S)
    
    print(S)
    
    if S == "":
        print("YES")
    else:
        print("NO")
    
if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    S = input()
    
    S = S.split("dreameraser")
    S = "".join(S)
    S = S.split("dreamerase")
    S = "".join(S)
    S = S.split("dreamer")
    S = "".join(S)
    S = S.split("eraser")
    S = "".join(S)
    S = S.split("dream")
    S = "".join(S)
    S = S.split("erase")
    S = "".join(S)
    
    #print(S)
    
    if S == "":
        print("YES")
    else:
        print("NO")
    
if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    S = input()
    
    S = S.split("dreameraser")
    S = "".join(S)
    S = S.split("dreamer")
    S = "".join(S)
    S = S.split("eraser")
    S = "".join(S)
    S = S.split("dream")
    S = "".join(S)
    S = S.split("erase")
    S = "".join(S)
    
    #print(S)
    
    if S == "":
        print("YES")
    else:
        print("NO")
    
if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    S = input()

    S = S.split("dream")
    S = "".join(S)
    S = S.split("eraser")
    S = "".join(S)
    S = S.split("dreamer")
    S = "".join(S)
    S = S.split("erase")
    S = "".join(S)

    
    #print(S)
    
    if S == "":
        print("YES")
    else:
        print("NO")
    
if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    S = input()

    S = S.split("dream")
    S = "".join(S)
    S = S.split("eraser")
    S = "".join(S)
    S = S.split("erase")
    S = "".join(S)

    S = S.split("dreamer")
    S = "".join(S)
    
    #print(S)
    
    if S == "":
        print("YES")
    else:
        print("NO")
    
if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    S = input()

    S = S.split("dream")
    S = "".join(S)
    S = S.split("erase")
    S = "".join(S)
    S = S.split("eraser")
    S = "".join(S)
    S = S.split("dreamer")
    S = "".join(S)

    
    if S == "":
        print("YES")
    else:
        print("NO")
    
if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    S = input()

    S = S.split("dream")
    S = "".join(S)
    S = S.split("erase")
    S = "".join(S)
    S = S.split("dreamer")
    S = "".join(S)
    S = S.split("eraser")
    S = "".join(S)
    
    if S == "":
        print("YES")
    else:
        print("NO")
    
if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    S = input()
    S = S.split("dreamer")
    S = "".join(S)
    S = S.split("dream")
    S = "".join(S)
    S = S.split("eraser")
    S = "".join(S)
    S = S.split("erase")
    S = "".join(S)
    
    if S == "":
        print("YES")
    else:
        print("NO")
    
if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
s=input().replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if s:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

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