Buggy python submission (verdict: Time Limit Exceeded):
def main():
    s = str(input())
    n = len(s)
    ans = [0] * n
    move = 2 * n
    for i in range(n):
        position = i
        for j in range(move):
            if s[position] == "R":
                position += 1
            else:
                position -= 1
        ans[position] += 1
    print(*ans)


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    s = str(input())
    n = len(s)
    ans = [0] * n
    for i in range(n):
        if s[i] == "R":
            if i != (n - 1) and s[i + 1] == "L":
                ans[i] += 1
                for j in range(i - 2, -1, -2):
                    if s[j] == "R" and s[j + 1] == "R":
                        ans[i] += 1
                    else:
                        break
            for j in range(i + 2, n, 2):
                if s[j - 1] == "L" and s[j] == "L":
                    ans[i] += 1
                else:
                    break
        else:  # s[i] == "L"
            if i != 0 and s[i - 1] == "R":
                ans[i] += 1
                for j in range(i + 2, n, 2):
                    if s[j - 1] == "L" and s[j] == "L":
                        ans[i] += 1
                    else:
                        break
            for j in range(i - 2, -1, -2):
                if s[j] == "R" and s[j + 1] == "R":
                    ans[i] += 1
                else:
                    break
    print(*ans)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    s = str(input())
    n = len(s)
    ans = [0] * n
    move = 2 * 10 ** 5
    for i in range(n):
        position = i
        for j in range(move):
            if s[position] == "R":
                position += 1
            else:
                position -= 1
        ans[position] += 1
    print(*ans)


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    s = str(input())
    n = len(s)
    ans = [0] * n
    for i in range(n):
        if s[i] == "R":
            if i != (n - 1) and s[i + 1] == "L":
                ans[i] += 1
                for j in range(i - 2, -1, -2):
                    if s[j] == "R" and s[j + 1] == "R":
                        ans[i] += 1
                    else:
                        break
            for j in range(i + 2, n, 2):
                if s[j - 1] == "L" and s[j] == "L":
                    ans[i] += 1
                else:
                    break
        else:  # s[i] == "L"
            if i != 0 and s[i - 1] == "R":
                ans[i] += 1
                for j in range(i + 2, n, 2):
                    if s[j - 1] == "L" and s[j] == "L":
                        ans[i] += 1
                    else:
                        break
            for j in range(i - 2, -1, -2):
                if s[j] == "R" and s[j + 1] == "R":
                    ans[i] += 1
                else:
                    break
    print(*ans)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    s = str(input())
    n = len(s)
    ans = [0] * n
    move = 2 * 10 ** 6
    for i in range(n):
        position = i
        for j in range(move):
            if s[position] == "R":
                position += 1
            else:
                position -= 1
        ans[position] += 1
    print(*ans)


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    s = str(input())
    n = len(s)
    ans = [0] * n
    for i in range(n):
        if s[i] == "R":
            if i != (n - 1) and s[i + 1] == "L":
                ans[i] += 1
                for j in range(i - 2, -1, -2):
                    if s[j] == "R" and s[j + 1] == "R":
                        ans[i] += 1
                    else:
                        break
            for j in range(i + 2, n, 2):
                if s[j - 1] == "L" and s[j] == "L":
                    ans[i] += 1
                else:
                    break
        else:  # s[i] == "L"
            if i != 0 and s[i - 1] == "R":
                ans[i] += 1
                for j in range(i + 2, n, 2):
                    if s[j - 1] == "L" and s[j] == "L":
                        ans[i] += 1
                    else:
                        break
            for j in range(i - 2, -1, -2):
                if s[j] == "R" and s[j + 1] == "R":
                    ans[i] += 1
                else:
                    break
    print(*ans)


if __name__ == '__main__':
    main()