s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
stringlengths
1
5
memory
stringlengths
1
7
code_size
stringlengths
1
6
code
stringlengths
1
539k
s401591846
p03854
u064246852
1551905065
Python
Python (3.4.3)
py
Runtime Error
132
98540
441
def solve(S): if S in ["dream","dreamer","erase","eraser"]: return True elif len(S) <= 7: return False if S[0:7] == "dreamer": return solve(S[7:]) or solve(S[5:]) elif S[0:5] == "dream": return solve(S[5:]) if S[0:6] == "eraser": return solve(S[6:]) or solve(S[5:]) elif S[0:5] == "erase": return solve(S[5:]) return False print("YES" if solve(input()) else "NO")
s751216375
p03854
u095426154
1551852025
Python
Python (3.4.3)
py
Runtime Error
17
3060
781
st=input() j="0" u="0" for i in st: if i=="d" and u=="0": u="d" j="1" elif i=="r" and u=="d": u="r1" elif i=="e" and u=="r1": u="e1" elif i=="a" and u=="e1": u="a1" elif i=="m" and u=="a1": u="0" elif i=="e" and u=="0": u="e2" j="2" elif i=="r" and u=="e2": u="0" """""" elif i=="e" and u=="0": u="e3" j="0" elif i=="r" and u=="e3": u="r2" """""" elif i=="a" and u=="0" and j=="2": u="a2" elif i=="s" and u=="a2": u="s" elif i=="e" and u=="s": u="0" j="3" elif i=="r" and j=="3": j="0" else: print("NO") exit(0) if u=="0": print("YES") else: print("NO")
s981833636
p03854
u585482323
1551654538
Python
PyPy3 (2.4.0)
py
Runtime Error
212
51184
1289
#!usr/bin/env python3 from collections import defaultdict from heapq import heappush, heappop import sys import math import bisect import random def LI(): return list(map(int, sys.stdin.readline().split())) def I(): return int(sys.stdin.readline()) def LS():return list(map(list, sys.stdin.readline().split())) def S(): return list(sys.stdin.readline())[:-1] def IR(n): l = [None for i in range(n)] for i in range(n):l[i] = I() return l def LIR(n): l = [None for i in range(n)] for i in range(n):l[i] = LI() return l def SR(n): l = [None for i in range(n)] for i in range(n):l[i] = S() return l def LSR(n): l = [None for i in range(n)] for i in range(n):l[i] = SR() return l mod = 1000000007 #A #B #C s = S() while s: if s[:7] == list("dreamer"): i = 5 while s[i:i+5] == list("erase"): i += 5 if s[i] == "r":i+=1 s = s[i:] elif s[:6] == list("eraser"): while s[i:i+5] == list("erase"): i += 5 if s[i] == "r":i+=1 s = s[i:] elif s[:5] == list("dream"): s = s[5:] elif s[:5] == list("erase"): s = s[5:] else: print("NO") quit() print("YES") #D #E #F #G #H #I #J #K #L #M #N #O #P #Q #R #S #T
s143049008
p03854
u496744988
1551364787
Python
Python (3.4.3)
py
Runtime Error
1649
136380
687
import sys s = list(input()) check =['dream','dreamer','erase','eraser'] while len(s) >= 8: if ''.join(s[-5:]) == check[0]: print(s) for _ in range(5): s.pop() continue if ''.join(s[-7:]) == check[1]: print(s) for _ in range(7): s.pop() continue if ''.join(s[-5:]) == check[2]: print(s) for _ in range(5): s.pop() continue if ''.join(s[-6:]) == check[3]: print(s) for _ in range(6): s.pop() continue print('No') sys.exit() if ''.join(s) == check[0] or ''.join(s) == check[1] or ''.join(s) == check[2] or ''.join(s) == check[3]: print('Yes') else: print('No')
s031035326
p03854
u083960235
1551239396
Python
Python (3.4.3)
py
Runtime Error
19
3188
473
s1=input().replace("eraser","") s2=s1.replace("erase","") s3=s2.replace("dreamer","") s4=s3.replace("dream","") if s: print("No") else: print("Yes") """ #failed import itertools s=str(input()) add=["dream","dreamer","erase","eraser"] t=[] for i,_ in enumerate(add,1): for j in itertools.permutations(add,r=i): t.append("".join(j)) print(t) temp=False for i in range(len(t)): if(s==t[i]): temp=True break if temp==True: print("Yes") else: print("No") """
s655728239
p03854
u815659544
1551221688
Python
Python (3.4.3)
py
Runtime Error
18
3060
390
l_o = ['dream','dreamer', 'ereaser', 'erase'] l_r = [x[::-1] for x in l_o] mi = min([len(word) for word in l_o]) print(helper(input()[::-1])) def helper(s): print(s) if s == '': return True elif len(s) < mi: return False else: for word in l_r: if s.startswith(word): return helper(s[len(word):]) return False
s450269888
p03854
u126823513
1551137145
Python
Python (3.4.3)
py
Runtime Error
183
134492
527
int_s = input() str_sr = int_s[::-1] str_a = ['dream', 'dreamer', 'erase', 'eraser'] str_r = list(map(lambda x: x[::-1], str_a)) result = True while len(str_sr): currnt_flg = False for r in str_r: print('r:' + r) if len(str_sr) >= len(r) and str_sr[:len(r)] == r: print('ok') str_sr = str_sr[len(r):] print(str_sr) current_flg = True break else: result = False break if result: print('YES') else: print('NO')
s806197326
p03854
u649126012
1550982154
Python
Python (3.4.3)
py
Runtime Error
123
98596
781
#!/usr/bin/env python3 # Daydream import sys YES = "YES" # type: str NO = "NO" # type: str tokens = ['dream', 'dreamer', 'erase', 'eraser'] def solve(S: str): print(YES if is_valid(S) else NO) return def is_valid(S): if S == '': return True for token in tokens: sub = S[-len(token):] if sub == token: return is_valid(S[:-len(token)]) return False def is_valid2(S): import re x = r"^(dream|dreamer|erase|eraser)*$" return True if re.match(x, S) else False def main(): def iterate_tokens(): for line in sys.stdin: for word in line.split(): yield word tokens = iterate_tokens() S = next(tokens) # type: str solve(S) if __name__ == '__main__': main()
s936592698
p03854
u649126012
1550975998
Python
Python (3.4.3)
py
Runtime Error
134
98592
665
#!/usr/bin/env python3 # Daydream import sys YES = "YES" # type: str NO = "NO" # type: str tokens = ['dream', 'dreamer', 'erase', 'eraser'] def solve(S: str): print(YES if is_valid(S) else NO) return def is_valid(S): if S in tokens: return True for token in tokens: sub = S[-len(token):] if sub == token: return is_valid(S[:-len(token)]) return False def main(): def iterate_tokens(): for line in sys.stdin: for word in line.split(): yield word tokens = iterate_tokens() S = next(tokens) # type: str solve(S) if __name__ == '__main__': main()
s779739748
p03854
u334624175
1550940701
Python
Python (3.4.3)
py
Runtime Error
122
98472
409
pattern = ["maerd", "remaerd", "esare", "resare"] def rec(s): if (len(s) == 0): return True for candidate in pattern: if s[:len(candidate)] == candidate: rec(s[len(candidate):]) return True return False def main(): S = input() S = S[::-1] if rec(S): print("YES") else: print("NO") if __name__ == "__main__": main()
s395401839
p03854
u598720217
1550901670
Python
Python (3.4.3)
py
Runtime Error
17
3188
530
S = input() S = S[::-1] l = ['dream','dreamer','erase','eraser'] L = [] for i in l: L.append(i[::-1]) def rec(s): flag=False for ii in L: leng = len(ii) if len(s)<leng: continue else: if s[num:leng]==ii: if len(s)==leng: flag=True break else: return rec(s[leng:]) else: continue return flag f = rec(S) if f: print('YES') else: print('NO')
s279205292
p03854
u598720217
1550900199
Python
Python (3.4.3)
py
Runtime Error
123
98568
538
S = input() S = S[::-1] l = ['dream','dreamer','erase','eraser'] L = [] for i in l: L.append(i[::-1]) num=0 def rec(s): flag=False for ii in L: leng = len(ii) if len(s)<leng: continue else: if s[num:leng]==ii: if len(s)==leng: flag=True break else: return rec(s[leng:]) else: continue return flag f = rec(S) if f: print('YES') else: print('NO')
s166117940
p03854
u598720217
1550900131
Python
Python (3.4.3)
py
Runtime Error
132
98576
547
S = input() S = S[::-1] l = ['dream','dreamer','erase','eraser'] L = [] for i in l: L.append(i[::-1]) print(L) num=0 def rec(s): flag=False for ii in L: leng = len(ii) if len(s)<leng: continue else: if s[num:leng]==ii: if len(s)==leng: flag=True break else: return rec(s[leng:]) else: continue return flag f = rec(S) if f: print('YES') else: print('NO')
s206414605
p03854
u598720217
1550896554
Python
Python (3.4.3)
py
Runtime Error
133
98232
1021
S = input() def rec(s): leng = len(s) if leng==0: print('YES') else: if leng>4: if s[0:5]=="dream": if leng==5: rec(s[5:]) else: if s[5:7]=="er": if s[5:10]=="erase": if leng==10: rec(s[10:]) elif s[10]=="r": rec(s[11:]) else: rec(s[10:]) else: rec(s[7:]) else: rec(s[5:]) elif s[0:5]=="erase": if leng==5: rec(s[5:]) else: if s[5]=="r": rec(s[6:]) else: rec(s[5:]) else: print('NO') else: print('NO') rec(S)
s335009226
p03854
u598720217
1550814974
Python
Python (3.4.3)
py
Runtime Error
125
98220
860
S = input() def rec(s): leng = len(s) if leng==0: print('YES') else: if s[0:5]=="dream": if leng==5: rec(s[5:]) else: if s[5:7]=="er": if s[5:10]=="erase": if leng==10: rec(s[10:]) elif s[10]=="r": rec(s[11:]) else: rec(s[10:]) else: rec(s[7:]) else: rec(s[5:]) elif s[0:5]=="erase": if leng==5: rec(s[5:]) else: if s[5]=="r": rec(s[6:]) else: rec(s[5:]) else: print('NO') rec(S)
s937191701
p03854
u598720217
1550814449
Python
Python (3.4.3)
py
Runtime Error
132
98228
781
S = input() def rec(s): leng = len(s) if leng==0: print('YES') else: if s[0:5]=="dream": if leng==5: rec(s[5:]) else: if s[5:7]=="er": if s[5:10]=="erase": if s[10]=="r": rec(s[11:]) else: rec(s[10:]) else: rec(s[7:]) else: rec(s[5:]) elif s[0:5]=="erase": if leng==5: rec(s[5:]) else: if s[5]=="r": rec(s[6:]) else: rec(s[5:]) else: print('NO') rec(S)
s383168360
p03854
u598720217
1550814020
Python
Python (3.4.3)
py
Runtime Error
130
98220
781
S = input() def rec(s): leng = len(s) if leng==0: print('YES') else: if s[0:5]=="dream": if leng==5: rec(s[5:]) else: if s[5:7]=="er": if s[5:10]=="erase": if s[10]=="r": rec(s[11:]) else: rec(s[10:]) else: rec(s[7:]) else: rec(s[5:]) elif s[0:5]=="erase": if leng==5: rec(s[5:]) else: if s[5]=="r": rec(s[6:]) else: rec(s[5:]) else: print('NO') rec(S)
s902744979
p03854
u598720217
1550813970
Python
Python (3.4.3)
py
Runtime Error
245
206372
855
S = input() def rec(s): print(s) leng = len(s) if leng==0: print('YES') else: if s[0:5]=="dream": if leng==5: rec(s[5:]) else: if s[5:7]=="er": if s[5:10]=="erase": if s[10]=="r": rec(s[11:]) else: rec(s[10:]) else: rec(s[7:]) else: print("s:") print(s) rec(s[5:]) elif s[0:5]=="erase": if leng==5: rec(s[5:]) else: if s[5]=="r": rec(s[6:]) else: rec(s[5:]) else: print('NO') rec(S)
s342556252
p03854
u562767072
1550603386
Python
Python (3.4.3)
py
Runtime Error
18
3188
427
S = input() sys.setrecursionlimit(10**7) def is_ok(s): if len(s)==0: return 'YES' elif len(s)<5: return 'NO' elif s[-7:]=='dreamer': next_s = s[:-7] elif s[-6:]=='eraser': next_s = s[:-6] elif s[-5:]=='dream' or s[-5:]=='erase': next_s = s[:-5] else: return 'NO' # import pdb;pdb.set_trace() ans = is_ok(next_s) return ans print(is_ok(S))
s381522561
p03854
u562767072
1550602634
Python
Python (3.4.3)
py
Runtime Error
122
98560
396
S = input() def is_ok(s): if len(s)==0: return 'YES' elif len(s)<5: return 'NO' elif s[-7:]=='dreamer': next_s = s[:-7] elif s[-6:]=='eraser': next_s = s[:-6] elif s[-5:]=='dream' or s[-5:]=='erase': next_s = s[:-5] else: return 'NO' # import pdb;pdb.set_trace() ans = is_ok(next_s) return ans print(is_ok(S))
s561576606
p03854
u027285843
1550009488
Python
Python (3.4.3)
py
Runtime Error
17
2940
53
if S=T : print("YES") else if S!=T : print("NO")
s988936589
p03854
u027285843
1550009332
Python
Python (3.4.3)
py
Runtime Error
17
2940
1
a
s819066997
p03854
u686283589
1549780828
Python
Python (3.4.3)
py
Runtime Error
147
98660
290
import re def func(s): text = [ 'dream', 'dreamer', 'erase', 'eraser'] if len(s) == 0: print('YES') exit() for t in text: if re.match(t, s): func(s.replace(t, '', 1)) if __name__ == '__main__': s = input() func(s) print('NO')
s704678060
p03854
u938106887
1549595156
Python
Python (3.4.3)
py
Runtime Error
2104
134404
528
# -*- coding:utf-8 -*- S = input() words = ['dream', 'dreamer', 'erase', 'eraser'] result = True while len(S) != 0 and result == True: print(S) for i in range(5,8): if i == 8: result = False break if S[-i:] == words[0]: S = S[:-i] break elif S[-i:] == words[1]: S = S[:-i] break elif S[-i:] == words[2]: S = S[:-i] break elif S[-i:] == words[3]: S = S[:-i] break else: continue if result == True: print('YES') else: print('NO')
s626269420
p03854
u548308904
1549503386
Python
Python (3.4.3)
py
Runtime Error
18
2940
531
inp = input() m = 0 n = 0 li = ['dream','dreamer','erase','eraser'] while True: for i in li: if inp.startswith(i): inpp = inp.replace(i,'',1) if inpp == '': m = 1 break for k in li: if inpp.startswith(k): inp = inpp n = 1 break else: if k == 'eraser': break continue break if m == 1: print('YES') break if n != 1: print('NO') break
s381919970
p03854
u977389981
1549126703
Python
Python (3.4.3)
py
Runtime Error
79
6424
235
s = input() def f(t): if len(t) > len(s): return False if t == s: return True return f(t + 'dream') or f(t + 'erase') or f(t + 'dreamer') or f(t + 'eraser') if f(''): print('YES') else: print('NO')
s997790336
p03854
u225482186
1549057466
Python
Python (3.4.3)
py
Runtime Error
18
3064
797
s = input() s = s[::-1] s = list(s) #print(s) count = 0 can = True jm = [] j = 0 maxcount = 0 for i in s: jm.append(s[j]) j += 1 count += 1 if count > 7: can = False # print(0) break elif "".join(jm) == "maerd": maxcount += count count,j = 0,0 # print(1) elif "".join(jm) == "remaerd": maxcount += count count,j = 0,0 jm = [] # print(2) elif "".join(jm) == "esare": maxcount += count count,j = 0,0 jm = [] # print(jm + 1) elif "".join(jm) == "rersare": maxcount += count count,j = 0,0 jm = [] else: pass #print("forward bool is" + str(can)) if maxcount == 0: can = False if can: print("YES") else: print("NO")
s532402641
p03854
u374103100
1548970180
Python
Python (3.4.3)
py
Runtime Error
160
160036
668
S = input() def is_composable(s): if len(s) == 0: return True if s.startswith("dreamer"): dream_s = s[5:] dreamer_s = s[7:] return is_composable(dream_s) or is_composable(dreamer_s) elif s.startswith("dream"): dream_s = s[5:] return is_composable(dream_s) elif s.startswith("eraser"): erase_s = s[5:] eraser_s = s[6:] return is_composable(erase_s) or is_composable(eraser_s) elif s.startswith("erase"): erase_s = s[5:] return is_composable(erase_s) else: return False if len(S) > 0 and is_composable(S): print("YES") else: print("NO")
s241219648
p03854
u374103100
1548969944
Python
Python (3.4.3)
py
Runtime Error
136
110596
668
S = input() def is_composable(s): if len(s) == 0: return True if s.startswith("dreamer"): dream_s = s[5:] dreamer_s = s[7:] return is_composable(dream_s) or is_composable(dreamer_s) elif s.startswith("dream"): dream_s = s[5:] return is_composable(dream_s) elif s.startswith("eraser"): erase_s = s[5:] eraser_s = s[6:] return is_composable(erase_s) or is_composable(eraser_s) elif S.startswith("erase"): erase_s = s[5:] return is_composable(erase_s) else: return False if len(S) > 0 and is_composable(S): print("YES") else: print("NO")
s243445726
p03854
u239981649
1548846253
Python
Python (3.4.3)
py
Runtime Error
2104
5104
435
from collections import deque A = deque(input()) while len(A) >= 2: if list(A)[-5:] == list("dream") or list("erase"): for _ in range(5): A.pop() elif list(A)[-6:] == list("eraser"): for _ in range(6): A.pop() elif list(A)[-7:] == list("dreamer"): for _ in range(7): A.pop() else: A = deque([0]) if len(A) == 0: print("YES") else: print("NO")
s781970943
p03854
u239981649
1548843878
Python
Python (3.4.3)
py
Runtime Error
25
4980
544
from collections import deque A = deque(input()) while A != deque() and A != deque([0]): if list(A)[:7] == list("dreamer") and list(A)[5:10] != list("erase"): for _ in range(7): A.leftpop() elif A[:5] == list("dream"): for _ in range(5): A.leftpop() elif A[:6] == list("eraser"): for _ in range(6): A.leftpop() elif A[:5] == list("erase"): for _ in range(5): A.leftpop() else: A = [0] if A == []: print("YES") else: print("NO")
s358572367
p03854
u239981649
1548843034
Python
Python (3.4.3)
py
Runtime Error
24
4212
388
from collections import deque A = deque(input()) while A != [] and A != [0]: if A[:7] == list("dreamer") and A[5:10] != list("erase"): A = A[7:] elif A[:5] == list("dream"): A = A[5:] elif A[:6] == list("eraser"): A = A[6:] elif A[:5] == list("erase"): A = A[5:] else: A = [0] if A == []: print("YES") else: print("NO")
s061414435
p03854
u794250528
1548100828
Python
Python (3.4.3)
py
Runtime Error
104
52140
212
def solve(s): if len(s) == 0: return True return any(solve(s[len(prefix):]) for prefix in ('dreamer', 'dream', 'eraser', 'erase') if s.startswith(prefix)) print('YES' if solve(input()) else 'NO')
s678215233
p03854
u417794477
1547678336
Python
Python (3.4.3)
py
Runtime Error
694
137172
563
from collections import deque def DFS(S): word_list = ["dream", "dreamer", "erase", "eraser"] stack = deque(word_list) while stack: print(stack) word = stack.pop() if word == S[0]: return "Yes" for i in word_list: next_word = word + i check = S[0][:len(word + i)] if next_word != check: continue if next_word == check: stack.append(next_word) return "NO" if __name__ == "__main__": S = [input()] print(DFS(S))
s565800131
p03854
u023229441
1546927242
Python
Python (3.4.3)
py
Runtime Error
18
3188
152
a=input() a=a.replace("erase","") a=a.replace("dream","") a=a.replace("dreamer","") a=a.replace("eraser","") if a="": print("YES") else: print("NO")
s689554274
p03854
u126823513
1546258877
Python
Python (3.4.3)
py
Runtime Error
198
134496
526
int_s = input() str_sr = int_s[::-1] str_a = ['dream', 'dreamer', 'erase', 'eraser'] str_r = list(map(lambda x: x[::-1], str_a)) result = True while len(str_sr): currnt_flg = False for r in str_r: print('r:' + r) if len(str_sr) >= len(r) and str_sr[:len(r)] == r: print('ok') str_sr = str_sr[len(r):] print(str_sr) current_flg = True break else: result = False break if result: print('YES') else: print('No')
s554370680
p03854
u272557899
1545083928
Python
Python (3.4.3)
py
Runtime Error
19
3444
3091
s = input() i = 0 n = len(s) p = 0 while i < n: if i == 0: if s[i] == "d": if i + 5 <= n: if s[i:i+5] == "dream": i = i + 5 if s[i] != "e" and s[i] != "d": print("NO") exit() else: print("NO") exit() else: print("NO") exit() elif s[i] == "e": if i + 2 <= n: if s[i:i+2] == "er": i = i + 1 else: print("NO") exit() else: print("NO") exit() else: print("NO") exit() else: if s[i] == "d": if i + 5 <= n: if s[i:i+5] == "dream": i = i + 5 if s[i] == "e" or s[i] == "d": print("NO") exit() else: print("NO") exit() else: print("NO") exit() elif s[i] == "e": if i + 2 <= n: if s[i:i+2] == "er": i = i + 1 else: print("NO") exit() else: print("NO") exit() elif s[i] == "r": if s[i - 5: i + 1] == "eraser": if s[i - 2] != "r": if i + 1 < n: if s[i + 1] == "d": i = i + 1 elif s[i + 1] == "e": i = i + 1 else: print("NO") exit() p = 1 else: print("YES") exit() elif i + 4 <= n: if s[i - 2] != "r": if i + 1 < n: if s[i + 1] == "d": i = i + 1 elif s[i + 1] == "e": i = i + 1 p = 1 else: print("YES") exit() if s[i:i+4] == "rase": i = i + 4 p = 1 if p == 0: print("NO") exit() elif s[i - 2] != "r": if i + 1 < n: if s[i + 1] == "d": i = i + 1 elif s[i + 1] == "e": i = i + 1 else: print("NO") exit() else: print("YES") exit() else: print("NO") exit() else: print("NO") exit() p = 0 print("YES")
s435738894
p03854
u983918956
1545009578
Python
Python (3.4.3)
py
Runtime Error
19
3188
143
s = input() str_list = ["eraser","erase","dreamer","dream"] for e in str_list: s = s.replace(e) ans = "YES" if s == "" else "NO" print(ans)
s345335929
p03854
u077337864
1544637839
Python
Python (3.4.3)
py
Runtime Error
18
2940
260
S = input().strip() while True: if S.endswith('dream'): S = S[:-5] elif S.endswith('dreamer'): S = S[:-7] elif S.endswith('erase'): S = S[:-5] elif S.endswith('eraser'): S = S[:-6] else break if S: print("NO") else: print('YES')
s206117208
p03854
u492605584
1544514576
Python
Python (3.4.3)
py
Runtime Error
19
3188
151
S = input() S.replace("dreamer", "").replace("eraser", "").replace("dream","").r eplace("erase", "") if len(S) == 0: print("YES") else: print("NO")
s622933850
p03854
u893048163
1544062580
Python
Python (3.4.3)
py
Runtime Error
123
98572
469
ins = input() def foo(s): last = s[-1:] # is empty if not s: return "YES" else: n = 0 if last == 'r' and s[-6:] == 'eraser': n = -6 elif last == 'r' and s[-7:] == 'dreamer': n = -7 elif (last == 'e' and s[-5:] == 'erase') or (last == 'm' and s[-5:] == 'dream'): n = -5 if n == 0: return "NO" else: return foo(s[:n]) print(foo(ins))
s159743901
p03854
u893048163
1544062569
Python
Python (3.4.3)
py
Runtime Error
262
192780
482
ins = input() def foo(s): last = s[-1:] # is empty print(s) if not s: return "YES" else: n = 0 if last == 'r' and s[-6:] == 'eraser': n = -6 elif last == 'r' and s[-7:] == 'dreamer': n = -7 elif (last == 'e' and s[-5:] == 'erase') or (last == 'm' and s[-5:] == 'dream'): n = -5 if n == 0: return "NO" else: return foo(s[:n]) print(foo(ins))
s999913065
p03854
u893048163
1544061678
Python
Python (3.4.3)
py
Runtime Error
135
98588
469
ins = input() def foo(s): last = s[-1:] # is empty if not s: return "YES" else: n = 0 if last == 'r' and s[-6:] == 'eraser': n = -6 elif last == 'r' and s[-7:] == 'dreamer': n = -7 elif (last == 'e' and s[-5:] == 'erase') or (last == 'm' and s[-5:] == 'dream'): n = -5 if n == 0: return "NO" else: return foo(s[:n]) print(foo(ins))
s346620485
p03854
u893048163
1544061462
Python
Python (3.4.3)
py
Runtime Error
135
98568
468
ins = input() def foo(s): last = s[-1] # is empty if not s: return "YES" else: n = 0 if last == 'r' and s[-6:] == 'eraser': n = -6 elif last == 'r' and s[-7:] == 'dreamer': n = -7 elif (last == 'e' and s[-5:] == 'erase') or (last == 'm' and s[-5:] == 'dream'): n = -5 if n == 0: return "NO" else: return foo(s[:n]) print(foo(ins))
s522320733
p03854
u205580583
1543550503
Python
Python (3.4.3)
py
Runtime Error
18
3188
604
s = input() ichi = 0 cnt = 0 l = len(s) while True: s_dreamer = s.find ("dreamer",ichi,l) s_eraser = s.find ("eraser",ichi,l) s_dream = s.find ("dream",ichi,l) s_erase = s.find ("erase",ichi,l) if s_dream == ichi: ichi = s_dreamer + 7 cnt += 7 elif s_eras == ichi: ichi = s_eraser + 6 cnt += 6 elif s_dreamer == ichi: ichi = s_dream + 5 cnt += 5 elif s_eraser == ichi: ichi = s_erase + 5 cnt += 5 elif cnt == l: print("YES") break else: print("NO") break
s462735302
p03854
u920299620
1543269672
Python
Python (3.4.3)
py
Runtime Error
30
3316
1233
s=input() ind =0 len_s=len(s) s = s+ "zzzzzzzzzz" A = "dreamer" B= "dream" C= "erase" D="eraser" flag =True while(1): if(s[ind] =="d"): if(s[ind + 5] =="d"): if(s[ind:ind+5]!=B): flag = False break else: ind+=5 else: if(s[ind+5]!='e'): flag=False break if(s[ind+7] == "a"): if(s[ind:ind+5]!=B): flag = False break else: ind+=5 else: if(s[ind:ind+7] !=A): flag = false break else: ind+=7 elif(s[ind]=="e"): if(s[ind+5]=="r"): if(s[ind:ind+6]!=D): flag = False break else: ind+=6 else: if(s[ind:ind +5] !=C): flag =False break else: ind+=5 else: flag=False break if(ind == len_s): break if(ind > len_s): flag=False break if(flag): print("YES") else: print("NO")
s608929336
p03854
u920299620
1543269625
Python
Python (3.4.3)
py
Runtime Error
31
3316
1234
s=input() ind =0 len_s=len(s) s = s+ "zzzzzzzzzz" A = "dreamer" B= "dream" C= "erase" D="eraser" flag =True while(1): if(s[ind] =="d"): if(s[ind + 5] =="d"): if(s[ind:ind+5]!=B): flag = False break else: ind+=5 else: if(s[ind+5]!='e'): flag=False break if(s[ind+7] == "a"): if(s[ind:ind+5]!=B): flag = False break else: ind+=5 else: if(s[ind:ind+7] !=A): flag = false break else: ind+=7 elif(s[ind]=="e"): if(s[ind+5]=="r"): if(s[ind:ind+6]!=D): flag = False break else: ind+=6 else: if(s[ind:ind +5] !=C): flag =False break else: ind+=5 else: flag=False break if(ind == len_s): break if(ind > len(s)): flag=False break if(flag): print("YES") else: print("NO")
s898185896
p03854
u920299620
1543269557
Python
Python (3.4.3)
py
Runtime Error
18
3064
1198
s=input() ind =0 len_s=len(s) s = s+ "zzzzzzzzzz" A = "dreamer" B= "dream" C= "erase" D="eraser" flag =True while(1): if(s[ind] =="d"): if(s[ind + 5] =="d"): if(s[ind:ind+5]!=B): flag = False break else: ind+=5 else: if(s[ind+5]!='e'): flag=False break if(s[ind+7] == "a"): if(s[ind:ind+5]!=B): flag = False break else: ind+=5 else(s[ind:ind+7] !=A): flag = false break else: ind+=7 elif(s[ind]=="e"): if(s[ind+5]=="r"): if(s[ind:ind+6]!=D): flag = False break else: ind+=6 else: if(s[ind:ind +5] !=C): flag =False break else: ind+=5 else: flag=False break if(ind == len_s): break if(ind > len(s)): flag=False break if(flag): print("YES") else: print("NO")
s784120409
p03854
u233152254
1543184653
Python
Python (3.4.3)
py
Runtime Error
124
98560
410
S = input() def func(S): if S == '': return True a, b, c, d = False, False, False, False if S[0:5] == 'dream': a = func(S[5:]) if S[5:7] == 'er': b = func(S[7:]) elif S[0:5] == 'erase': c = func(S[5:]) if S[5] == 'r': d = func(S[6:]) else: return False return a or b or c or d print('YES' if func(S) else 'NO')
s460329401
p03854
u445511055
1543126249
Python
Python (3.4.3)
py
Runtime Error
179
134432
511
# -*- coding: utf-8 -*- def check(string): if string[-5:] == "dream": new = string[:-5] return new if string[-7:] == "dreamer": new = string[:-7] return new if string[-5:] == "erase": new = string[:-5] return new if string[-6:] == "eraser": new = string[:-6] return new print("NO") if __name__ == '__main__': s = str(input()) while s: print(s) s = check(s) if s == "": print("YES")
s941943028
p03854
u001024152
1542159737
Python
Python (3.4.3)
py
Runtime Error
185
134424
760
import sys S = input() S = S[::-1] while S: if S[:3]=="res": if S[:6]=="resare": S = S[6:] print(S) else: print("NO") sys.exit() elif S[:3]=="esa": if S[:5]=="esare": S = S[5:] print(S) else: print("NO") sys.exit() elif S[:3]=="rem": if S[:7]=="remaerd": S = S[7:] print(S) else: print("NO") sys.exit() elif S[:3]=="mae": if S[:5]=="maerd": S = S[5:] print(S) else: print("NO") sys.exit() else: print("NO") sys.exit() else: print("YES")
s457780301
p03854
u131666536
1542138616
Python
Python (3.4.3)
py
Runtime Error
17
2940
353
# -*- coding: utf-8 -*- s = input() while len(s) > 4: if s[-5:] == 'deram' or s[-5:] == 'erase: s = s[:-5] continue elif s[-6:] == 'eraser': s = s[:-6] continue elif s[-7:] == 'dreamer': s = s[:-7] continue else: break if len(s) == 0: print('YES') else: print('NO')
s460488674
p03854
u131666536
1542138438
Python
Python (3.4.3)
py
Runtime Error
18
3060
349
# -*- coding: utf-8 -*- s = input() while len(s): if s[-5:] == 'deram' or s[-5:] == 'erase: s = s[:-5] continue elif s[-6:] == 'eraser': s = s[:-6] continue elif s[-7:] == 'dreamer': s = s[:-7] continue else: break if len(s) == 0: print('YES') else: print('NO')
s557271319
p03854
u853900545
1541265710
Python
Python (3.4.3)
py
Runtime Error
20
3188
266
s = input() while len(s) > 0 : if s[:7] == 'dreamer': del s[:7] elif s[:7] == 'eraser': del s[:7] elif s[:5] == 'dream': del s[:5] elif s[:5] == 'erase': del s[:5] else: break print(('NO','Yes')[len(s)==0])
s607923890
p03854
u724892495
1539292610
Python
Python (3.4.3)
py
Runtime Error
126
98552
219
W=["dream", "dreamer", "erase", "eraser" ] def srch(word): if word=="": print("YES") exit() for w in W: if word[:len(w)] == w: srch(word[len(w):]) srch(input()) print("NO")
s419130466
p03854
u611249982
1538019457
Python
Python (3.4.3)
py
Runtime Error
98
4208
339
#!/usr/bin/python3 # -*- coding: utf-8 -*- s = input() words = ['dream', 'dreamer', 'erase', 'eraser'] def dfs(n): if n == len(s): return True for w in words: if s[n:].startswith(w): if dfs(n + len(w)): return True return False if dfs(0): print('YES') else: print('NO')
s455661495
p03854
u611249982
1538019168
Python
Python (3.4.3)
py
Runtime Error
82
4120
364
#!/usr/bin/python3 # -*- coding: utf-8 -*- s = input() words = ['dream', 'dreamer', 'erase', 'eraser'] L = len(max(words, key=len)) def dfs(n): if n == len(s): return True for w in words: if w in s[n:n + L]: if dfs(n + len(w)): return True return False if dfs(0): print('YES') else: print('NO')
s279189998
p03854
u611249982
1538019073
Python
Python (3.4.3)
py
Runtime Error
82
4108
330
#!/usr/bin/python3 # -*- coding: utf-8 -*- s = input() words = ['dream', 'dreamer', 'erase', 'eraser'] def dfs(n): if n == len(s): return True for w in words: if w in s[n:]: if dfs(n + len(w)): return True return False if dfs(0): print('YES') else: print('NO')
s280514389
p03854
u388323466
1537930355
Python
Python (3.4.3)
py
Runtime Error
67
3188
367
s = input() while len(s)>4: if s[-5:] == 'dream': s = s[:-5] continue elif s[-7:] == 'dreamer': s = s[:-7] continue elif s[-5:] == 'erase': s = s[:-5] continue elif s[-6:] == 'eraser': s = s[:-6] continue else: beak if s =='' : print('YES') else: print('NO')
s306862838
p03854
u388323466
1537930032
Python
Python (3.4.3)
py
Runtime Error
68
3188
296
s = input() while len(s)>4: 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: beak if s =='' : print('YES') else: print('NO')
s539946970
p03854
u237362582
1537225934
Python
Python (3.4.3)
py
Runtime Error
75
4116
435
def check(i): flag = False for each_word in word_list: if not flag and each_word == S[0+i:len(each_word)+i]: if len(each_word)+i < len(S): flag = check(len(each_word)+i) else: flag = True return flag S = input() word_list = ['dream', 'dreamer', 'erase', 'eraser'] flag = False flag = check(0) if flag: print('YES') else: print('NO')
s413953408
p03854
u237362582
1537225497
Python
Python (3.4.3)
py
Runtime Error
76
4112
467
def check(i): flag = False for each_word in word_list: if not flag and each_word == S[0+i:len(each_word)+i]: if len(each_word)+i < len(S): flag = check(len(each_word)+i) else: flag = True return flag S = input() word_list = ['dream', 'dreamer', 'erase', 'eraser'] flag = False for each_word in word_list: flag = check(0) if flag: print('YES') else: print('NO')
s807758927
p03854
u548624367
1536601036
Python
Python (3.4.3)
py
Runtime Error
17
2940
1088
#include "bits/stdc++.h" using namespace std; typedef long long ll; #define INF (1<<30) #define INFLL (1ll<<60) typedef pair<int, int> P; typedef pair<int, P> E; #define MOD (1000000007ll) #define l_ength size void mul_mod(ll& a, ll b){ a *= b; a %= MOD; } void add_mod(ll& a, ll b){ b += MOD; a += b; a %= MOD; } int n; string s,d="dreamer",e="eraser"; bool memo[123456],done[123456]; bool dp(int i){ int j,p=0; if(done[i]){ return memo[i]; } done[i] = true; memo[i] = false; if(i==n){ memo[i] = true; return memo[i]; } if(s[i]!='d' && s[i]!='e'){ return memo[i]; } if(s[i]=='d'){ for(j=i; j<min(n,j+7); ++j){ if(s[j]!=d[j-i]){ break; } ++p; } if(p==7){ memo[i] = dp(i+5)|dp(i+7); }else if(p==5){ memo[i] = dp(i+5); } }else{ for(j=i; j<min(n,j+6); ++j){ if(s[j]!=e[j-i]){ break; } ++p; } if(p==5 || p==6){ memo[i] = dp(i+p); }else{ memo[i] = false; } } return memo[i]; } int main(void){ fill(done,done+123456,false); cin >> s; n = s.l_ength(); cout << ((dp(0)?"YES":"NO")) << endl; return 0; }
s974852453
p03854
u044952145
1536055228
Python
Python (3.4.3)
py
Runtime Error
75
4052
295
S = input() ls = len(S) def dfs(i): if i == ls: return True elif S[i: i+5] == "dream" or S[i: i+5] == "erase" or S[i: i+6] == "eraser" or S[i: i+7] == "dreamer": return dfs(i+5) or dfs(i+6) or dfs(i+7) return False if dfs(0): print("YES") else: print("NO")
s931408762
p03854
u926024306
1535557468
Python
Python (3.4.3)
py
Runtime Error
17
3064
701
a=list(S) n=0 while n<len(a): oldn=n if a[n] == "e": if n+4<len(a) and a[n+1]=="r" and a[n+2]=="a" and a[n+3]=="s" and a[n+4]=="e": if n+5<len(a) and a[n+5]=="r": n=n+6 else: n=n+5 else: if a[n] == "d": if n+4<len(a) and a[n+1]=="r" and a[n+2]=="e" and a[n+3]=="a" and a[n+4]=="m": if n+6<len(a) and a[n+5]=="e" and a[n+6] == "r": if n+7<len(a) and a[n+7]=="a": n=n+5 else: n=n+7 else: n=n+5 if oldn == n: print("NO") break else: print("OK")
s987301553
p03854
u926024306
1535557437
Python
Python (2.7.6)
py
Runtime Error
11
2696
701
a=list(S) n=0 while n<len(a): oldn=n if a[n] == "e": if n+4<len(a) and a[n+1]=="r" and a[n+2]=="a" and a[n+3]=="s" and a[n+4]=="e": if n+5<len(a) and a[n+5]=="r": n=n+6 else: n=n+5 else: if a[n] == "d": if n+4<len(a) and a[n+1]=="r" and a[n+2]=="e" and a[n+3]=="a" and a[n+4]=="m": if n+6<len(a) and a[n+5]=="e" and a[n+6] == "r": if n+7<len(a) and a[n+7]=="a": n=n+5 else: n=n+7 else: n=n+5 if oldn == n: print("NO") break else: print("OK")
s258594244
p03854
u138486156
1535136223
Python
Python (3.4.3)
py
Runtime Error
1916
136732
717
s = input() s_list = list(s) while True: l5 = s_list[-5:] l6 = s_list[-6:] l7 = s_list[-7:] s5 = s6 = s7 = '' for ch in l5: s5 += ch print("s5 :", s5) for ch in l6: s6 += ch print("s6 :", s6) for ch in l7: s7 += ch print("s7 :", s7) if (s5 == 'erase') | (s5 == 'dream'): s_list = s_list[:-5] print("s_list:", s_list) elif s6 == 'eraser': s_list = s_list[:-6] print("s_list:", s_list) elif s7 == 'dreamer': s_list = s_list[:-7] print("s_list:", s_list) else: print('NO') print("s_list:", s_list) exit() if s_list == []: print('YES') exit()
s131136302
p03854
u073775598
1535066537
Python
Python (3.4.3)
py
Runtime Error
17
2940
136
s=input().replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","") if s: print("NO") else: print("YES"
s935212838
p03854
u826263061
1534353172
Python
Python (3.4.3)
py
Runtime Error
17
3064
670
i = len(s) ans = 'YES' while True: if s[-5:] == a[0] or s[-5:] == a[2]: i -= 5 if i == 0: ans = 'YES' break elif i<5: ans = 'NO' break s = s[:i] elif i>=6 and s[-6:] == a[3]: i -= 6 if i == 0: ans = 'YES' break elif i<5: ans = 'NO' break s = s[:i] elif i>=7 and s[-7:] == a[1]: i -= 7 if i == 0: ans = 'YES' break elif i<5: ans = 'NO' break s = s[:i] else: ans = 'NO' break #print(s) print(ans)
s487168915
p03854
u329006798
1533669269
Python
Python (3.4.3)
py
Runtime Error
18
3188
394
def test(): s = input() divide = ["dream", "dreamer", "erase", "eraser"] dp = [0 for i in range(10010)] dp[0] = 1 for i in range(len(dp)): if dp[len(s)] == 1: print('YES') return 0 if dp[i] == 0: continue for d in divide: if s[i:i+len(d)] == d: dp[i+len(d)] = 1 print('NO') test()
s172225958
p03854
u329006798
1533669117
Python
Python (3.4.3)
py
Runtime Error
19
3188
426
def test(): s = input() divide = ["dream", "dreamer", "erase", "eraser"] dp = [0 for i in range(10010)] dp[0] = 1 for i in range(len(dp)): if dp[len(s)] == 1: print('YES') return 0 if dp[i] == 0: continue for d in divide: if s[i:i+len(d)] == d: dp[i+len(d)] = 1 print(i+len(d)) print('NO') test()
s712981057
p03854
u599547273
1530051691
Python
Python (3.4.3)
py
Runtime Error
135
100272
569
import sys sys.setrecursionlimit(2000) def text_match_words(text, words): match_words = [] for word in words: if word == text[:len(word)]: match_words.append(word) return match_words def is_match_for(text, words): if "" == text: return True else: match_words = text_match_words(text, words) if [] == match_words: return False else: return any([is_match_for(text[len(match_word):], words) for match_word in match_words]) words = ("dream", "dreamer", "erase", "eraser") s = input() if is_match_for(s, words): print("YES") else: print("NO")
s544708440
p03854
u599547273
1530051651
Python
Python (3.4.3)
py
Runtime Error
17
3064
559
sys.setrecursionlimit(2000) def text_match_words(text, words): match_words = [] for word in words: if word == text[:len(word)]: match_words.append(word) return match_words def is_match_for(text, words): if "" == text: return True else: match_words = text_match_words(text, words) if [] == match_words: return False else: return any([is_match_for(text[len(match_word):], words) for match_word in match_words]) words = ("dream", "dreamer", "erase", "eraser") s = input() if is_match_for(s, words): print("YES") else: print("NO")
s716908357
p03854
u599547273
1530051062
Python
Python (3.4.3)
py
Runtime Error
103
52320
508
def text_match_words(text, words): match_words = [] for word in words: if word == text[:len(word)]: match_words.append(word) return match_words def is_match_for(text, words): if "" == text: return True else: match_words = text_match_words(text, words) if [] == match_words: return False else: return any([is_match_for(text[len(match_word):], words) for match_word in match_words]) if is_match_for(input(), ("dream", "dreamer", "erase", "eraser")): print("YES") else: print("NO")
s513959610
p03854
u599547273
1530050678
Python
Python (3.4.3)
py
Runtime Error
107
52328
529
def text_match_words(text, words): match_words = [] for word in words: if word == text[:len(word)]: match_words.append(word) return match_words def is_match_for(text, words): if "" == text: return True else: match_words = text_match_words(text, words) if [] == match_words: return False else: return any([is_match_for(text[len(match_word):], words) for match_word in match_words]) words = ("dream", "dreamer", "erase", "eraser") s = input() if is_match_for(s, words): print("YES") else: print("NO")
s381013392
p03854
u599547273
1530050359
Python
Python (3.4.3)
py
Runtime Error
106
52328
562
def text_match_words(text, words): match_words = [] for word in words: if word == text[:len(word)]: match_words.append(word) return match_words def is_match_for(text, words): if "" == text: return True else: match_words = text_match_words(text, words) if [] == match_words: return False else: return any([is_match_for(text[len(match_word):], words) for match_word in match_words]) if __name__ == "__main__": words = ("dream", "dreamer", "erase", "eraser") s = input() if is_match_for(s, words): print("YES") else: print("NO")
s005598645
p03854
u599547273
1530049968
Python
Python (3.4.3)
py
Runtime Error
106
52324
529
def text_match_words(text, words): match_words = [] for word in words: if word == text[:len(word)]: match_words.append(word) return match_words def is_match_for(text, words): if "" == text: return True else: match_words = text_match_words(text, words) if [] == match_words: return False else: return any([is_match_for(text[len(match_word):], words) for match_word in match_words]) words = ("dream", "dreamer", "erase", "eraser") s = input() if is_match_for(s, words): print("YES") else: print("NO")
s205320555
p03854
u599547273
1530049440
Python
Python (3.4.3)
py
Runtime Error
105
52324
531
def text_match_words(text, words): match_words = [] for word in words: if word == text[:len(word)]: match_words.append(word) return match_words def is_match_for(text, words): if "" == text: return True else: match_words = text_match_words(text, words) if [] == match_words: return False else: return any([is_match_for(text[len(match_word):], words) for match_word in match_words]) s = input() words = ("dream", "dreamer", "erase", "eraser") if is_match_for(s, words): print("YES") else: print("NO")
s085159054
p03854
u599547273
1530049293
Python
Python (3.4.3)
py
Runtime Error
104
52324
531
def text_match_words(text, words): match_words = [] for word in words: if word == text[:len(word)]: match_words.append(word) return match_words def is_match_for(text, words): if "" == text: return True else: match_words = text_match_words(text, words) if [] == match_words: return False else: return any([is_match_for(text[len(match_word):], words) for match_word in match_words]) s = input() words = ("dream", "dreamer", "erase", "eraser") if is_match_for(s, words): print("YES") else: print("NO")
s024904671
p03854
u717763253
1529293919
Python
Python (3.4.3)
py
Runtime Error
17
2940
377
# s = 'dreamdareamer' s = input() lists = [ 'dream', 'dreamer', 'erase', 'eraser' ] stack = [''] rtn = 'NO' while len(stack)>0: txt = stack.pop(0) for item in lists: tmp_txt = txt + item if tmp_txt == s: stack = [] rtn = 'YES' break if( len(tmp_txt) < len(s) ): stack.append(tmp_txt) print(rtn)
s467878263
p03854
u335295553
1529091590
Python
Python (3.4.3)
py
Runtime Error
19
4084
313
import sys S = input() S = S.split("er") for s in S: if s not in {'asedream', 'dream', 'as'}: if s != '': print("NO") sys.exit() else: flag = False if s == "": if flag: print("NO") sys.exit() flag = True print("YES")
s906934094
p03854
u813450984
1529039117
Python
Python (3.4.3)
py
Runtime Error
77
6452
311
s = input() ans = False def dfs(now, length): global ans if len(now) >= length: if now == s: ans = True return dfs(now + 'dream', length) dfs(now + 'dreamer', length) dfs(now + 'erase', length) dfs(now + 'eraser', length) dfs('', len(s)) if ans: print('YES') else: print('NO')
s693490926
p03854
u681340020
1526665733
Python
Python (3.4.3)
py
Runtime Error
105
51976
527
s = input().rstrip() d = ['dream', 'dreamer'] e = ['erase', 'eraser'] ch = d + e def search_(s, ch): if len(s) == 0: return True if len(s) < len(ch): return False else: if s[:len(ch)] == ch: return search(s[len(ch):]) return False def search(s): if len(s) == 0: return True if s[0] == 'd' or s[0] == 'e': for ci in ch: if search_(s, ci): return True return False if search(s): print('YES') else: print('NO')
s380208535
p03854
u681340020
1526665570
Python
Python (3.4.3)
py
Runtime Error
104
51984
510
s = input().rstrip() d = ['dream', 'dreamer'] e = ['erase', 'eraser'] ch = d + e def search_(s, ch): if len(s) == 0: return True if len(s) < len(ch): return False else: if s[:len(ch)] == ch: return search(s[len(ch):]) def search(s): if len(s) == 0: return True if s[0] == 'd' or s[0] == 'e': for ci in ch: if search_(s, ci): return True return False if search(s): print('YES') else: print('NO')
s045496436
p03854
u156931988
1526315214
Python
Python (3.4.3)
py
Runtime Error
127
98536
506
def tree(str): if(str == ""): return True if(str.startswith("d")): if(str.startswith("dream")): tree(str.replace("dream","",1)) if (str.startswith("dreamer")): tree(str.replace("dreamer","",1)) elif(str.startswith("e")): if (str.startswith("erase")): tree(str.replace("erase","",1)) if (str.startswith("eraser")): tree(str.replace("eraser","",1)) st = input() if(tree(st)) : print("YES") else: print("NO")
s765622325
p03854
u156931988
1526253663
Python
Python (3.4.3)
py
Runtime Error
126
98544
508
st = input() def tree(str): if(str == ""): return True if(str.startswith("d")): if(str.startswith("dream")): tree(str.replace("dream","",1)) if (str.startswith("dreamer")): tree(str.replace("dreamer","",1)) elif(str.startswith("e")): if (str.startswith("erase")): tree(str.replace("erase","",1)) if (str.startswith("eraser")): tree(str.replace("eraser","",1)) if(tree(st)) : print("YES") else: print("NO")
s173963425
p03854
u156931988
1526253399
Python
Python (3.4.3)
py
Runtime Error
138
99428
514
import sys st = input() def tree(str): if(str == ""): print("YES") sys.exit() if(str.startswith("d")): if(str.startswith("dream")): tree(str.replace("dream","",1)) if (str.startswith("dreamer")): tree(str.replace("dreamer","",1)) elif(str.startswith("e")): if (str.startswith("erase")): tree(str.replace("erase","",1)) if (str.startswith("eraser")): tree(str.replace("eraser","",1)) tree(st) print("NO")
s031488198
p03854
u156931988
1526253346
Python
Python (3.4.3)
py
Runtime Error
127
98544
514
import sys st = input() def tree(str): if(str == ""): print("YES") sys.exit() if(str.startswith("d")): if(str.startswith("dream")): tree(str.replace("dream","",1)) if (str.startswith("dreamer")): tree(str.replace("dreamer","",1)) elif(str.startswith("e")): if (str.startswith("erase")): tree(str.replace("erase","",1)) if (str.startswith("eraser")): tree(str.replace("eraser","",1)) tree(st) print("NO")
s942778678
p03854
u818655004
1525592841
Python
Python (3.4.3)
py
Runtime Error
49
3188
450
s = input() n_s = len(s) S = '' for i in range(n_s): S += s[-i-1] words = ["maerd", "remaerd", "esare", "resare"] cnt = 0 result = 'Yes' while True: if S[cnt:cnt+5] == 'maerd': cnt += 5 elif S[cnt:cnt+5] == 'esare': cnt += 5 elif S[cnt:cnt+6] == 'resare': cnt += 6 elif S[cnt:cnt+7] == 'remaerd': cnt += 7 else: result = 'No' break if cnt == n_S: break print(result)
s559027777
p03854
u926295427
1524354313
Python
Python (3.4.3)
py
Runtime Error
569
134488
277
#!python # -*- coding: utf-8 -*- S = input() + '_' T_s = ["dream", "dreamer", "erase", "eraser"] while True: S_ = S for T in T_s: S = S.replace(T + "_", "_") print(S) if S_ == S: break if S == "_": print("YES") else: print("NO")
s496364127
p03854
u557171945
1523563269
Python
PyPy3 (2.4.0)
py
Runtime Error
1173
135728
338
s = input() cs = s judge = True while 0<len(cs): if cs[:5]=='dream': cs = cs[5:] if cs[:2]=='er' and not cs[:5]=='erase': cs = cs[2:] elif cs[:5]=='erase': cs = cs[5:] if cs[0]=='r': cs = cs[1:] else: judge = False break print('YES' if judge else 'NO')
s096163322
p03854
u952708174
1522621629
Python
Python (3.4.3)
py
Runtime Error
18
3188
495
def c_daydream(S): import re # Sを逆にしたものから該当する文字を除いていき、空文字列にできるか? s = S[::-1] dict = ['dream'[::-1], 'dreamer'[::-1], 'erase'[::-1], 'eraser'[::-1]] n = len(s) while n > 0: for d in dict: if s.startswith(d): s = re.sub('^' + d, '', s) break else: return 'NO' n = len(s) return 'YES' S = input().strip() print(c_Daydream(S))
s953240363
p03854
u865741247
1522395117
Python
Python (3.4.3)
py
Runtime Error
72
3188
593
s=input() w=["dream","dreamer","erase","eraser",""] while True: if s[0:5]==w[0]: if s[5:7]=="er": #dremaerかeraserかerase if s[7]=="a": #erはeraseかeraserのer s=s[5:] else: s=s[7:] else: s=s[5:] elif s[0:5]==w[2]: if s[5]=="r": s=s[6:] else: s=s[5:] else: print("NO") exit() if len(s)<=6: if s in w: print("YES") exit() else: print("NO") exit() #print(s)
s669970077
p03854
u865741247
1522394732
Python
Python (3.4.3)
py
Runtime Error
75
3188
613
s=input() w=["dream","dreamer","erase","eraser"] while True: if len(s)==0: print("YES") exit() if len(s)<=4: print("NO") exit() if s[0:5]==w[0]: if s[5:7]=="er": #dremaerかeraserかerase if s[7]=="a": #erはeraseかeraserのer s=s[5:] else: s=s[7:] else: s=s[5:] elif s[0:5]==w[2]: if s[5]=="r": s=s[6:] else: s=s[5:] else: print("NO") exit() if len(s)==0: print("YES") exit() #print(s)
s405453419
p03854
u865741247
1522394515
Python
Python (3.4.3)
py
Runtime Error
73
3188
499
s=input() w=["dream","dreamer","erase","eraser"] while True: if s[0:5]==w[0]: if s[5:7]=="er": #dremaerかeraserかerase if s[7]=="a": #erはeraseかeraserのer s=s[5:] else: s=s[7:] else: s=s[5:] elif s[0:5]==w[2]: if s[5]=="r": s=s[6:] else: s=s[5:] else: print("NO") exit() if len(s)==0: print("YES") exit() #print(s)
s334439275
p03854
u005388620
1522388530
Python
Python (3.4.3)
py
Runtime Error
77
4120
557
def main(): s = input() flag = greedy(s,len(s)) if flag: print("YES") else: print("NO") def greedy(s2,end): if end > 7: if s2[end-7:end] == "dreamer": return greedy(s2,end-7) elif s2[end-6:end] == "eraser": return greedy(s2,end-6) elif (s2[end-5:end] == "dream") or (s2[end-5:end] =="erase"): return greedy(s2,end-5) else: return False else: if (s2[:end] == "dreamer") or (s2[:end] == "dream") or \ (s2[:end] == "eraser") or (s2[:end] == "erase"): return True else: return False if __name__ == "__main__": main()
s402641202
p03854
u005388620
1522387718
Python
Python (3.4.3)
py
Runtime Error
76
4196
489
def main(): s = input() flag = greedy(s,len(s)) if flag: print("YES") else: print("NO") def greedy(s2,end): if end > 7: if s2[end-7:end] == "dreamer": return greedy(s2,end-7) elif s2[end-6:end] == "eraser": return greedy(s2,end-6) elif s2[end-5:end] == "dream" or "erase": return greedy(s2,end-5) else: return False else: if s2[:end] == "dreamer" or "dream" or "eraser" or "erase": return True else: return False if __name__ == "__main__": main()
s100997724
p03854
u524619829
1521940747
Python
Python (3.4.3)
py
Runtime Error
123
98460
414
# -*- coding: utf-8 -*- def is_contains_word(s, words): for word in words: if s == '': return True if s.endswith(word): return is_contains_word(s[:-len(word)], words) return False def main(): s = input() words = ('dream', 'dreamer', 'erase', 'eraser') print('YES') if is_contains_word(s, words) else print('NO') if __name__ == '__main__': main()
s395357658
p03854
u524619829
1521936694
Python
Python (3.4.3)
py
Runtime Error
121
98452
414
# -*- coding: utf-8 -*- def is_contains_word(s, words): for word in words: if s == '': return True if s.endswith(word): return is_contains_word(s[:-len(word)], words) return False def main(): s = input() words = ('dream', 'dreamer', 'erase', 'eraser') print('YES') if is_contains_word(s, words) else print('NO') if __name__ == '__main__': main()
s654037548
p03854
u632369368
1520755302
Python
Python (3.4.3)
py
Runtime Error
662
139236
337
from collections import deque S = input() words = ['dream', 'dreamer', 'erase', 'eraser'] Q = deque(['']) found = False while Q: w = Q.popleft() if S == w: found = True break for nw in words: if len(w + nw) <= len(S): Q.appendleft(w + nw) print(Q) print('YES' if found else 'NO')