Buggy python submission (verdict: Time Limit Exceeded):
from sys import exit, stdin

S = list(stdin.readline().rstrip())
ans = [0 for _ in S]

for i, s in enumerate(S):
    flag = True
    if s == 'R':
        index = i
        while flag:
            index += 1
            if S[index] == 'L':
                if (index - i) % 2 == 1:
                    ans[index-1] += 1
                else:
                    ans[index] += 1
                flag = False
for i, s in enumerate(S):
    flag = True
    if s == 'L':
        index = i
        while flag:
            index -= 1
            if S[index] == 'R':
                if (i - index) % 2 == 1:
                    ans[index+1] += 1
                else:
                    ans[index] += 1
                flag = False
print(*ans)

Fixed submission:
from sys import exit, stdin

S = list(stdin.readline().rstrip())
ls = len(S)

candidates = []
for i in range(ls-1):
    if S[i] == 'R' and S[i+1] == 'L':
        candidates.append(i)
lc = len(candidates)

ans = [0 for _ in S]

for i in range(lc):
    l_index, r_index = candidates[i], candidates[i]+1

    while l_index > 0 and S[l_index - 1] == 'R':
        l_index -= 1
    while r_index + 1 < ls and S[r_index + 1] == 'L':
        r_index += 1

    even, odd = 0, 0
    idx = candidates[i]

    for j in range(l_index, idx):
        if (idx-j) % 2 == 0:
            even += 1
        else:
            odd += 1
    for j in range(idx, r_index+1):
        if (j-idx) % 2 == 0:
            even += 1
        else:
            odd += 1
    
    ans[idx] += even
    ans[idx+1] += odd

print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
from sys import exit, stdin

S = list(stdin.readline().rstrip())
ans = [0 for _ in S]

for i, s in enumerate(S):
    flag = True
    if s == 'R':
        index = i
        while flag:
            index += 1
            if S[index] == 'L':
                if (index - i) % 2 == 1:
                    ans[index-1] += 1
                else:
                    ans[index] += 1
                flag = False
    else:
        index = i
        while flag:
            index -= 1
            if S[index] == 'R':
                if (i - index) % 2 == 1:
                    ans[index+1] += 1
                else:
                    ans[index] += 1
                flag = False
print(*ans)

Fixed submission:
from sys import exit, stdin

S = list(stdin.readline().rstrip())
ls = len(S)

candidates = []
for i in range(ls-1):
    if S[i] == 'R' and S[i+1] == 'L':
        candidates.append(i)
lc = len(candidates)

ans = [0 for _ in S]

for i in range(lc):
    l_index, r_index = candidates[i], candidates[i]+1

    while l_index > 0 and S[l_index - 1] == 'R':
        l_index -= 1
    while r_index + 1 < ls and S[r_index + 1] == 'L':
        r_index += 1

    even, odd = 0, 0
    idx = candidates[i]

    for j in range(l_index, idx):
        if (idx-j) % 2 == 0:
            even += 1
        else:
            odd += 1
    for j in range(idx, r_index+1):
        if (j-idx) % 2 == 0:
            even += 1
        else:
            odd += 1
    
    ans[idx] += even
    ans[idx+1] += odd

print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
from sys import exit, stdin

S = list(stdin.readline().rstrip())
ans = [0 for _ in S]

for i, s in enumerate(S):
    flag = True
    if s == 'R':
        index = i
        while flag:
            index += 1
            if S[index] == 'L':
                if (index - i) % 2 == 1:
                    ans[index-1] += 1
                else:
                    ans[index] += 1
                flag = False
    else:
        index = i
        while flag:
            index -= 1
            if S[index] == 'R':
                if (i - index) % 2 == 1:
                    ans[index+1] += 1
                else:
                    ans[index] += 1
                flag = False
print(*ans)

Fixed submission:
from sys import exit, stdin

S = list(stdin.readline().rstrip())
ls = len(S)

candidates = []
for i in range(ls-1):
    if S[i] == 'R' and S[i+1] == 'L':
        candidates.append(i)
lc = len(candidates)

ans = [0 for _ in S]

for i in range(lc):
    l_index, r_index = candidates[i], candidates[i]+1

    while l_index > 0 and S[l_index - 1] == 'R':
        l_index -= 1
    while r_index + 1 < ls and S[r_index + 1] == 'L':
        r_index += 1

    even, odd = 0, 0
    idx = candidates[i]

    for j in range(l_index, idx):
        if (idx-j) % 2 == 0:
            even += 1
        else:
            odd += 1
    for j in range(idx, r_index+1):
        if (j-idx) % 2 == 0:
            even += 1
        else:
            odd += 1
    
    ans[idx] += even
    ans[idx+1] += odd

print(*ans)