Buggy python submission (verdict: Runtime Error):
S = input()
s = list(S)
p = []
q = []
ans = [0 for i in range(len(s))]
for i in range(len(s)-1):
    if s[i] == 'L' and s[i+1] == 'R':
        p.append(i)
for i in range(len(s)-1):
    if s[i] == 'R' and s[i+1] == 'L':
        q.append(i)
if (p[0]-q[0])%2 == 0:
    ans[q[0]] = -(-(p[0]+1)//2)
else:
    ans[q[0]] = (p[0]+1)//2
ans[q[0]+1] = p[0]+1-ans[q[0]]
for i in range(len(p)-1):
    if (p[i+1]-q[i+1])%2 == 0:
        ans[q[i+1]] = -(-(p[i+1]-p[i])//2)
    else:
        ans[q[i+1]] = (p[i+1]-p[i])//2
    ans[q[i+1]+1] = p[i+1]-p[i]-ans[q[i+1]]
if (p[-1]-q[-1])%2 == 0:
    ans[q[-1]] = -(-(len(s)-p[-1]-1)//2)
else:
    ans[q[-1]] = (len(s)-p[-1]-1)//2
ans[q[-1]+1] = len(s) - p[-1] -1 - ans[q[-1]]
for i in range(len(ans)):
    print(ans[i],end=' ')

Fixed submission:
S = input()
s = list(S)
p = []
q = []
ans = [0 for i in range(len(s))]
for i in range(len(s)-1):
    if s[i] == 'L' and s[i+1] == 'R':
        p.append(i)
for i in range(len(s)-1):
    if s[i] == 'R' and s[i+1] == 'L':
        q.append(i)
if len(p) > 0:
    if (p[0]-q[0])%2 == 0:
        ans[q[0]] = -(-(p[0]+1)//2)
    else:
        ans[q[0]] = (p[0]+1)//2
    ans[q[0]+1] = p[0]+1-ans[q[0]]
    for i in range(len(p)-1):
        if (p[i+1]-q[i+1])%2 == 0:
            ans[q[i+1]] = -(-(p[i+1]-p[i])//2)
        else:
            ans[q[i+1]] = (p[i+1]-p[i])//2
        ans[q[i+1]+1] = p[i+1]-p[i]-ans[q[i+1]]
    if (len(s)+1-q[-1])%2 == 0:
        ans[q[-1]] = -(-(len(s)-p[-1]-1)//2)
    else:
        ans[q[-1]] = (len(s)-p[-1]-1)//2
    ans[q[-1]+1] = len(s) - p[-1] -1 - ans[q[-1]]
else:
    if (len(s)+1-q[-1])%2 == 0:
        ans[q[-1]] = -(-(len(s))//2)
    else:
        ans[q[-1]] = (len(s))//2
    ans[q[-1]+1] = len(s) - ans[q[-1]]
for i in range(len(ans)):
    print(ans[i],end=' ')

Buggy python submission (verdict: Runtime Error):
S = input()
s = list(S)
p = []
q = []
ans = [0 for i in range(len(s))]
for i in range(len(s)-1):
    if s[i] == 'L' and s[i+1] == 'R':
        p.append(i)
for i in range(len(s)-1):
    if s[i] == 'R' and s[i+1] == 'L':
        q.append(i)
if (p[0]-q[0])%2 == 0:
    ans[q[0]] = -(-(p[0]+1)//2)
else:
    ans[q[0]] = (p[0]+1)//2
ans[q[0]+1] = p[0]+1-ans[q[0]]
for i in range(len(p)-1):
    if (p[i+1]-q[i+1])%2 == 0:
        ans[q[i+1]] = -(-(p[i+1]-p[i])//2)
    else:
        ans[q[i+1]] = (p[i+1]-p[i])//2
    ans[q[i+1]+1] = p[i+1]-p[i]-ans[q[i+1]]
if (p[-1]-q[-1])%2 == 0:
    ans[q[-1]] = -(-(len(s)-p[-1]-1)//2)
else:
    ans[q[-1]] = (len(s)-p[-1]-1)//2
ans[q[-1]+1] = len(s) - p[-1] -1 - ans[q[-1]]
print(ans)

Fixed submission:
S = input()
s = list(S)
p = []
q = []
ans = [0 for i in range(len(s))]
for i in range(len(s)-1):
    if s[i] == 'L' and s[i+1] == 'R':
        p.append(i)
for i in range(len(s)-1):
    if s[i] == 'R' and s[i+1] == 'L':
        q.append(i)
if len(p) > 0:
    if (p[0]-q[0])%2 == 0:
        ans[q[0]] = -(-(p[0]+1)//2)
    else:
        ans[q[0]] = (p[0]+1)//2
    ans[q[0]+1] = p[0]+1-ans[q[0]]
    for i in range(len(p)-1):
        if (p[i+1]-q[i+1])%2 == 0:
            ans[q[i+1]] = -(-(p[i+1]-p[i])//2)
        else:
            ans[q[i+1]] = (p[i+1]-p[i])//2
        ans[q[i+1]+1] = p[i+1]-p[i]-ans[q[i+1]]
    if (len(s)+1-q[-1])%2 == 0:
        ans[q[-1]] = -(-(len(s)-p[-1]-1)//2)
    else:
        ans[q[-1]] = (len(s)-p[-1]-1)//2
    ans[q[-1]+1] = len(s) - p[-1] -1 - ans[q[-1]]
else:
    if (len(s)+1-q[-1])%2 == 0:
        ans[q[-1]] = -(-(len(s))//2)
    else:
        ans[q[-1]] = (len(s))//2
    ans[q[-1]+1] = len(s) - ans[q[-1]]
for i in range(len(ans)):
    print(ans[i],end=' ')