Buggy python submission (verdict: Time Limit Exceeded):
_s = str(input())

l_arr = _s.split("L")
r_arr = _s.split("R")
l_max = max([len(x) for x in l_arr])
r_max = max([len(x) for x in r_arr])
t = max(l_max, r_max)
if t % 2 != 0:
    t -= 1

s = list(_s)

lg = len(s)
arr = [1 for i in range(lg)]

for i in range(t):
    next_arr = [0 for i in range(lg)]
    for j in range(lg):
        cmd = s[j]
        curr = arr[j]
        if cmd == "L":
            next_arr[j - 1] += curr
        else:
            next_arr[j + 1] += curr
    arr = next_arr
    
print(" ".join(map(str, arr)))

Fixed submission:
s = list(str(input()))
n = len(s)
ans = [0] * n
for ri in range(2):
    cnt = 0
    for i in range(n):
        if s[i] == "R":
            cnt += 1
        else:
            ans[i] += cnt // 2
            ans[i - 1] += (cnt + 1) // 2
            cnt = 0

    s.reverse()
    ans.reverse()
    for i in range(n):
        if s[i] == "L":
            s[i] = "R"
        else:
            s[i] = "L"

print(" ".join(map(str, ans)))

Buggy python submission (verdict: Runtime Error):
_s = str(input())
 
l_arr = _s.split("L")
r_arr = _s.split("R")
l_max = max([len(x) for x in l_arr])
r_max = max([len(x) for x in r_arr])
t = max(l_max, r_max)
if t % 2 != 0:
    t -= 1
 
s = list(_s)
 
lg = len(s)
arr = [1 for i in range(lg)]
 
for i in range(t):
    next_arr = [0 for i in range(lg)]
    for j in range(lg):
        cmd = s[j]
        curr = arr[j]
        if cmd == "L":
            next_arr[j - 1] += curr
        else:
            next_arr[j + 1] += curr
    arr = next_arr
    
print(" ".join(map(str, arr)))
_s = str(input())

l_arr = _s.split("L")
r_arr = _s.split("R")
l_max = max([len(x) for x in l_arr])
r_max = max([len(x) for x in r_arr])
t = max(l_max, r_max)
if t % 2 != 0:
    t -= 1

s = list(_s)

lg = len(s)
arr = [1 for i in range(lg)]

for i in range(t):
    next_arr = [0 for i in range(lg)]
    for j in range(lg):
        cmd = s[j]
        curr = arr[j]
        if cmd == "L":
            next_arr[j - 1] += curr
        else:
            next_arr[j + 1] += curr
    arr = next_arr
    
print(" ".join(map(str, arr)))
提出情報
提出日時	2019-08-12 10:13:16
問題	D - Gathering Children
ユーザ	rororo 
言語	PyPy3 (2.4.0)


Fixed submission:
s = list(str(input()))
n = len(s)
ans = [0] * n
for ri in range(2):
    cnt = 0
    for i in range(n):
        if s[i] == "R":
            cnt += 1
        else:
            ans[i] += cnt // 2
            ans[i - 1] += (cnt + 1) // 2
            cnt = 0

    s.reverse()
    ans.reverse()
    for i in range(n):
        if s[i] == "L":
            s[i] = "R"
        else:
            s[i] = "L"

print(" ".join(map(str, ans)))

Buggy python submission (verdict: Time Limit Exceeded):
_s = str(input())

l_arr = _s.split("L")
r_arr = _s.split("R")
l_max = max([len(x) for x in l_arr])
r_max = max([len(x) for x in r_arr])
t = max(l_max, r_max)
if t % 2 != 0:
    t -= 1

s = list(_s)

lg = len(s)
arr = [1 for i in range(lg)]

for i in range(t):
    next_arr = [0 for i in range(lg)]
    for j in range(lg):
        cmd = s[j]
        curr = arr[j]
        if cmd == "L":
            next_arr[j - 1] += curr
        else:
            next_arr[j + 1] += curr
    arr = next_arr
    
print(" ".join(map(str, arr)))

Fixed submission:
s = list(str(input()))
n = len(s)
ans = [0] * n
for ri in range(2):
    cnt = 0
    for i in range(n):
        if s[i] == "R":
            cnt += 1
        else:
            ans[i] += cnt // 2
            ans[i - 1] += (cnt + 1) // 2
            cnt = 0

    s.reverse()
    ans.reverse()
    for i in range(n):
        if s[i] == "L":
            s[i] = "R"
        else:
            s[i] = "L"

print(" ".join(map(str, ans)))