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

def to_dict_from_str(s):
    d = {}
    for i in range( len(s) ):
        d[i] = s[i]
    return d

if __name__ == '__main__':
    S_R = stdin.readline().rstrip()
    S_L = S_R[::-1]
    S_R = to_dict_from_str( S_R )
    S_L = to_dict_from_str( S_L )

    len_s = len( S_R )
    H = {}
    for i in range( len_s ):
        H[i] = 0

    # Rの探索
    for i in range( len_s - 1 ):
        s = S_R[i]
        if s == 'R':
            count = 1
            for j in range( i+1, len_s ):
                if S_R[j] == 'L':
                    index = j
                    break
                else:
                    count += 1

            if count % 2 == 0:
                H[ j ] += 1
            else:
                H[ j - 1 ] += 1
        else:
            pass

    # Lの探索
    for i in range( len_s - 1 ):
        s = S_L[i]
        if s == 'L':
            count = 1
            for j in range( i+1, len_s ):
                if S_L[j] == 'R':
                    index = j
                    break
                else:
                    count += 1

            if count % 2 == 0:
                H[ len_s - j - 1 ] += 1
            else:
                H[ len_s - (j - 1) - 1 ] += 1
        else:
            pass

    for i in range( len_s ):
        print( "{} ".format( H[i] ), end="" )
    print()

Fixed submission:
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

def main():
    S = input()
    S = list(S) + ['R']
    ans = [0]*len(S)
    b = 'L'
    index = []
    for i, s in enumerate(S):
        if b != s:
            index.append(i)
        b = s
    # print(index)
    for i in range(0, len(index)-2, 2):
        x = index[i]
        y = index[i + 1]
        z = index[i + 2]
        # print(x, y, z)
        a = y - x
        b = z - y
        ans[y-1] = (a+b)//2
        ans[y] = (a+b)//2
        if (a+b)%2 == 1:
            if a%2 == 1:
                ans[y-1] += 1
            if b%2 == 1:
                ans[y] += 1
    print(*ans[:-1])


if __name__ == '__main__':
    main()

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

if __name__ == '__main__':
    S_R = stdin.readline().rstrip()
    S_L = S_R[::-1]

    len_s = len( S_R )
    H = {}
    for i in range( len_s ):
        H[i] = 0

    # Rの探索
    for i in range( len_s - 1 ):
        s = S_R[i]
        if s == 'R':
            count = 1
            for j in range( i+1, len_s ):
                if S_R[j] == 'L':
                    index = j
                    break
                else:
                    count += 1

            if count % 2 == 0:
                H[ j ] += 1
            else:
                H[ j - 1 ] += 1
        else:
            pass

    # Lの探索
    for i in range( len_s - 1 ):
        s = S_L[i]
        if s == 'L':
            count = 1
            for j in range( i+1, len_s ):
                if S_L[j] == 'R':
                    index = j
                    break
                else:
                    count += 1

            if count % 2 == 0:
                H[ len_s - j - 1 ] += 1
            else:
                H[ len_s - (j - 1) - 1 ] += 1
        else:
            pass

    for i in range( len_s ):
        print( "{} ".format( H[i] ), end="" )
    print()

Fixed submission:
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

def main():
    S = input()
    S = list(S) + ['R']
    ans = [0]*len(S)
    b = 'L'
    index = []
    for i, s in enumerate(S):
        if b != s:
            index.append(i)
        b = s
    # print(index)
    for i in range(0, len(index)-2, 2):
        x = index[i]
        y = index[i + 1]
        z = index[i + 2]
        # print(x, y, z)
        a = y - x
        b = z - y
        ans[y-1] = (a+b)//2
        ans[y] = (a+b)//2
        if (a+b)%2 == 1:
            if a%2 == 1:
                ans[y-1] += 1
            if b%2 == 1:
                ans[y] += 1
    print(*ans[:-1])


if __name__ == '__main__':
    main()