Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline


def solve(S):
    def split(sub, result=[]):
        s = sub.partition('LR')
        if s[1] == '':
            return result + [s[0]]
        else:
            new_s = s[0] + s[1][0]
            rem = s[1][1] + s[2]
            return split(rem, result + [new_s])

    def count(sub):
        c = [0] * len(sub)
        l = sub.index('L')

        # R
        i = 1
        while l - i >= 0:
            c[l - (i % 2)] += 1
            i += 1

        # L
        i = 0
        while l + i < len(sub):
            c[l - (i % 2)] += 1
            i += 1

        return c

    ans = []
    for s in split(S):
        ans += count(s)
    return ans


def main():
    S = input().strip()
    ans = solve(S)

    for x in ans:
        print(x, end=' ')


if __name__ == "__main__":
    main()


Fixed submission:
import sys
input = sys.stdin.readline


def solve(S):
    def split(sub):
        result = []
        s = sub.partition('LR')
        while s[1] != '':
            new_s = s[0] + s[1][0]
            rem = s[1][1] + s[2]
            result.append(new_s)
            s = rem.partition('LR')
        return result + [s[0]]

    def count(sub):
        c = [0] * len(sub)
        l = sub.index('L')

        # R
        i = 1
        while l - i >= 0:
            c[l - (i % 2)] += 1
            i += 1

        # L
        i = 0
        while l + i < len(sub):
            c[l - (i % 2)] += 1
            i += 1

        return c

    ans = []
    for s in split(S):
        ans += count(s)
    return ans


def main():
    S = input().strip()
    ans = solve(S)

    for x in ans:
        print(x, end=' ')


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline


def main():
    S = input().strip()
    c = [0]*len(S)

    for i in range(len(S)):
        if S[i] == 'R':
            j = 1
            while S[i+j] == 'R':
                j += 1
            # i+j -> L
            if j % 2 == 0:
                c[i+j] += 1
            else:
                c[i+j-1] += 1
        if S[i] == 'L':
            j = -1
            while S[i+j] == 'L':
                j -= 1
            # i+j -> R
            if j % 2 == 0:
                c[i+j] += 1
            else:
                c[i+j+1] += 1

    for x in c:
        print(x, end=' ')


if __name__ == "__main__":
    main()


Fixed submission:
import sys
input = sys.stdin.readline


def solve(S):
    def split(sub):
        result = []
        s = sub.partition('LR')
        while s[1] != '':
            new_s = s[0] + s[1][0]
            rem = s[1][1] + s[2]
            result.append(new_s)
            s = rem.partition('LR')
        return result + [s[0]]

    def count(sub):
        c = [0] * len(sub)
        l = sub.index('L')

        # R
        i = 1
        while l - i >= 0:
            c[l - (i % 2)] += 1
            i += 1

        # L
        i = 0
        while l + i < len(sub):
            c[l - (i % 2)] += 1
            i += 1

        return c

    ans = []
    for s in split(S):
        ans += count(s)
    return ans


def main():
    S = input().strip()
    ans = solve(S)

    for x in ans:
        print(x, end=' ')


if __name__ == "__main__":
    main()