Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
N = len(S)

marker = [0] * N
for i in range(1, N - 1):
    if S[i] == "R" and S[i + 1] == "L":
        marker[i] = 1
    elif S[i - 1] == "R" and S[i] == "L":
        marker[i] = 2
    else:
        marker[i] = 0
marker[0] = 1 if S[1] == "L" else 0
marker[-1] = 2 if S[-2] == "R" else 0

cp = list(range(N))
p_last = [-1] * N   # ループに入る最初の座標
steps = [0] * N     # p_lastに着くまでのステップ数
dests = [0] * N     # 1: p_lastがR; 2: L
for i in range(N):
    s = 0
    cp = i
    while True:
        if p_last[cp] >= 0:
            p_last[i] = p_last[cp]
            steps[i] = s + steps[cp]
            dests[i] = marker[p_last[cp]]
            break
        elif marker[cp] == 0:
            s += 1
            if S[cp] == "R":
                cp += 1
            else:
                cp -= 1
        else:
            p_last[i] = cp
            steps[i] = s
            dests[i] = marker[cp]
            break

count = [0] * N
for i in range(N):
    pl = p_last[i]
    if dests[i] == 1:
        if steps[i] % 2 == 0:
            count[pl] += 1
        else:
            count[pl + 1] += 1
    else:
        if steps[i] % 2 == 0:
            count[pl] += 1
        else:
            count[pl - 1] += 1
print(" ".join(str(c) for c in count))

Fixed submission:
S = list(input())
N = len(S)

marker = [0] * N
for i in range(1, N - 1):
    if S[i] == "R" and S[i + 1] == "L":
        marker[i] = 1
    elif S[i - 1] == "R" and S[i] == "L":
        marker[i] = 2
    else:
        marker[i] = 0
marker[0] = 1 if S[1] == "L" else 0
marker[-1] = 2 if S[-2] == "R" else 0

cp = list(range(N))
p_last = [-1] * N   # ループに入る最初の座標
steps = [0] * N     # p_lastに着くまでのステップ数
dests = [0] * N     # 1: p_lastがR; 2: L
for i in range(N):
    s = 0
    cp = i
    hist = []   # 訪れた座標
    hist_append = hist.append
    while True:
        if p_last[cp] >= 0:
            p_last[i] = p_last[cp]
            steps[i] = s + steps[cp]
            dests[i] = marker[p_last[cp]]
            break
        elif marker[cp] == 0:
            s += 1
            if S[cp] == "R":
                cp += 1
            else:
                cp -= 1
            hist_append(cp)
        else:
            p_last[i] = cp
            steps[i] = s
            dests[i] = marker[cp]
            break

    for j, h in enumerate(hist[::-1], 1):
        p_last[h] = p_last[i]
        steps[h] = steps[i] - j
        dests[h] = dests[i]

count = [0] * N
for i in range(N):
    pl = p_last[i]
    if dests[i] == 1:
        if steps[i] % 2 == 0:
            count[pl] += 1
        else:
            count[pl + 1] += 1
    else:
        if steps[i] % 2 == 0:
            count[pl] += 1
        else:
            count[pl - 1] += 1
print(" ".join(str(c) for c in count))

Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
N = len(S)

marker = [0] * N
for i in range(1, N - 1):
    if S[i] == "R" and S[i + 1] == "L":
        marker[i] = 1
    elif S[i - 1] == "R" and S[i] == "L":
        marker[i] = 2
    else:
        marker[i] = 0
marker[0] = 1 if S[1] == "L" else 0
marker[-1] = 2 if S[-2] == "R" else 0

cp = list(range(N))
p_last = [-1] * N   # ループに入る最初の座標
steps = [0] * N     # p_lastに着くまでのステップ数
dests = [0] * N     # 1: p_lastがR; 2: L
for i in range(N):
    s = 0
    cp = i
    while True:
        if p_last[cp] >= 0:
            p_last[i] = p_last[cp]
            steps[i] = s + steps[cp]
            dests[i] = marker[p_last[cp]]
            break
        elif marker[cp] == 0:
            s += 1
            if S[cp] == "R":
                cp += 1
            else:
                cp -= 1
        else:
            p_last[i] = cp
            steps[i] = s
            dests[i] = marker[cp]
            break

count = [0] * N
for i in range(N):
    pl = p_last[i]
    if dests[i] == 1:
        if steps[i] % 2 == 0:
            count[pl] += 1
        else:
            count[pl + 1] += 1
    else:
        if steps[i] % 2 == 0:
            count[pl] += 1
        else:
            count[pl - 1] += 1
print(" ".join(str(c) for c in count))

Fixed submission:
S = list(input())
N = len(S)

marker = [0] * N
for i in range(1, N - 1):
    if S[i] == "R" and S[i + 1] == "L":
        marker[i] = 1
    elif S[i - 1] == "R" and S[i] == "L":
        marker[i] = 2
    else:
        marker[i] = 0
marker[0] = 1 if S[1] == "L" else 0
marker[-1] = 2 if S[-2] == "R" else 0

cp = list(range(N))
p_last = [-1] * N   # ループに入る最初の座標
steps = [0] * N     # p_lastに着くまでのステップ数
dests = [0] * N     # 1: p_lastがR; 2: L
for i in range(N):
    s = 0
    cp = i
    hist = []   # 訪れた座標
    hist_append = hist.append
    while True:
        if p_last[cp] >= 0:
            p_last[i] = p_last[cp]
            steps[i] = s + steps[cp]
            dests[i] = marker[p_last[cp]]
            break
        elif marker[cp] == 0:
            s += 1
            if S[cp] == "R":
                cp += 1
            else:
                cp -= 1
            hist_append(cp)
        else:
            p_last[i] = cp
            steps[i] = s
            dests[i] = marker[cp]
            break

    for j, h in enumerate(hist[::-1], 1):
        p_last[h] = p_last[i]
        steps[h] = steps[i] - j
        dests[h] = dests[i]

count = [0] * N
for i in range(N):
    pl = p_last[i]
    if dests[i] == 1:
        if steps[i] % 2 == 0:
            count[pl] += 1
        else:
            count[pl + 1] += 1
    else:
        if steps[i] % 2 == 0:
            count[pl] += 1
        else:
            count[pl - 1] += 1
print(" ".join(str(c) for c in count))