Problem p02954 (python)

Fixed submission:
li = input()
n = len(li)
child_li = [0] * n

ruiseki = 0
for i in range(n - 1):
    if li[i] == 'R':
        ruiseki += 1
        if li[i + 1] == 'L':
            child_li[i + 1] = ruiseki // 2
            child_li[i] = (ruiseki + 1) // 2
    else:
        ruiseki = 0
        
ruiseki = 0
for i in range(n - 1, 0, -1):
    if li[i] == 'L':
        ruiseki += 1
        if li[i - 1] == 'R':
            child_li[i - 1] += ruiseki // 2
            child_li[i] += (ruiseki + 1) // 2
    else:
        ruiseki = 0
print(*child_li)

Buggy submission (verdict: Runtime Error):
s = input()
max_ = 0
pre = s[0]
ren = 1
for i in range(1, len(s)):
    if s[i] == pre:
        ren += 1
        max_ = max(max_, ren)
    else:
        ren = 1
        pre = s[i]
from collections import deque
status = deque([[1] * len(s)])
for i in range(max_):
    sta = [0] * len(s)
    if s[1] == 'L':
        sta[0] = status[i][1]
    else:
        sta[0] = 0
    if s[-2] == 'R':
        sta[-1] = status[i][-2]
    else:
        sta[-1] = 0
    a = [[1] * len(s)]
    for j in range(1, len(s) - 1):
        #print(sta)
        if s[j - 1] == 'R':
            sta[j] += status[i][j - 1]
        if s[j + 1] == 'L':
            sta[j] += status[i][j + 1]
    status.append(sta)
for i in range(1 + max_ - 2):
    status.popleft()
if (max_ - 2) % 2 == 0:
    print(' '.join([str(i) for i in status[1]]))
else:
    print(' '.join([str(i) for i in status[0]]))

Buggy submission (verdict: Runtime Error):
s = input()
max_ = 0
pre = s[0]
ren = 1
for i in range(1, len(s)):
    if s[i] == pre:
        ren += 1
        max_ = max(max_, ren)
    else:
        ren = 1
        pre = s[i]
from collections import deque
status = deque([[1] * len(s)])
for i in range(max_):
    sta = [0] * len(s)
    if s[1] == 'L':
        sta[0] = status[i][1]
    else:
        sta[0] = 0
    if s[-2] == 'R':
        sta[-1] = status[i][-2]
    else:
        sta[-1] = 0
    a = [[1] * len(s)]
    for j in range(1, len(s) - 1):
        #print(sta)
        if s[j - 1] == 'R':
            sta[j] += status[i][j - 1]
        if s[j + 1] == 'L':
            sta[j] += status[i][j + 1]
    status.append(sta)
for i in range(1 + max_ - 2):
    status.popleft()
if (max_ - 2) % 2 == 0:
    print(' '.join([str(i) for i in status[1]]))
else:
    print(' '.join([str(i) for i in status[0]]))

Buggy submission (verdict: Runtime Error):
s = input()
max_ = 0
pre = s[0]
ren = 1
for i in range(1, len(s)):
    if s[i] == pre:
        ren += 1
        max_ = max(max_, ren)
    else:
        ren = 1
        pre = s[i]
from collections import deque
status = deque([[1] * len(s)])
for i in range(max_):
    sta = [0] * len(s)
    if s[1] == 'L':
        sta[0] = status[i][1]
    else:
        sta[0] = 0
    if s[-2] == 'R':
        sta[-1] = status[i][-2]
    else:
        sta[-1] = 0
    a = [[1] * len(s)]
    for j in range(1, len(s) - 1):
        #print(sta)
        if s[j - 1] == 'R':
            sta[j] += status[i][j - 1]
        if s[j + 1] == 'L':
            sta[j] += status[i][j + 1]
    status.append(sta)
for i in range(1 + max_ - 2):
    status.popleft()
if (max_ - 2) % 2 == 0:
    print(status[1])
else:
    print(status[0])