Buggy python submission (verdict: Time Limit Exceeded):
import copy

def op(children, S, stacks):
    ret = [0]*len(S)
    while any(stacks):
        # print(stacks)
        new_stack = [[] for _ in stacks]
        for i in range(len(S)):
            if stacks[i]:
                stacks[i].pop()
                ret[i] += 1
                if S[i] == 'R':
                    new_stack[i+1] += copy.copy(stacks[i])
                else:
                    new_stack[i-1] += copy.copy(stacks[i])
            
        stacks = new_stack
    return ret

def solve():
    S = input()
    children = [0] * len(S)
    stacks = [[] for _ in S]
    R_stack = []
    L_stack = []
    R_i = 0
    L_i = 1
    for idx,s in enumerate(S):
        if s == 'R':
            if L_stack:
                stacks[R_i] = copy.copy(L_stack)
                L_stack = []
            R_stack.append('R')
                    
        elif s == 'L':
            if R_stack and not L_stack:
                L_i = idx-1
                R_i = idx
                stacks[L_i] = copy.copy(R_stack)
                R_stack = []
            L_stack.append('L')
    if L_stack:
        stacks[R_i] = copy.copy(L_stack)
        L_stack = []
    children = op(children, S, stacks)
    print(' '.join(map(str, children)))

solve()

Fixed submission:
def solve():
    S = input()
    result = [0] * len(S)
    children_position = []
    even_odd_sum = []
    even_sum = 0
    odd_sum = 0
    R_i = 0
    L_i = -2
    
    for idx, s in enumerate(S):
        
        if s == 'R':
            R_i = idx
            if L_i+1 == R_i:
                even_odd_sum.append((even_sum, odd_sum))
                even_sum = 0
                odd_sum = 0
        elif s == 'L':
            L_i = idx
            if R_i+1 == idx:
                children_position.append((R_i, L_i))
                
        even_sum += idx % 2 == 0
        odd_sum += idx % 2 == 1
                
    even_odd_sum.append((even_sum, odd_sum))
    # print(children_position, even_odd_sum)
    for idx in range(len(children_position)):
        t = children_position[idx]
        even_odd_R = t[0] % 2
        even_odd_L = t[1] % 2
        
        result[t[0]] = even_odd_sum[idx][0] if even_odd_R == 0 else even_odd_sum[idx][1]
        result[t[1]] = even_odd_sum[idx][0] if even_odd_L == 0 else even_odd_sum[idx][1]
        
    
    print(' '.join(map(str, result)))
solve()

Buggy python submission (verdict: Time Limit Exceeded):
import copy
def op(children, S):
    ret = [0]*len(S)
    for i in range(len(S)):
        if S[i] == 'R':
            ret[i+1] += children[i]
        else:
            ret[i-1] += children[i]
    return ret

def solve():
    S = input()
    children = [1] * len(S)
    old_2 = [1] * len(S)
    old_1 = [1] * len(S)
    for i in range(1,10**5+1):
        children = op(children, S) 
        # print(children)
        if old_2 == children and i%2 == 0:
            break
        old_2 = copy.copy(old_1)
        old_1 = copy.copy(children)
    print(' '.join(map(str, children)))

solve()

Fixed submission:
def solve():
    S = input()
    result = [0] * len(S)
    children_position = []
    even_odd_sum = []
    even_sum = 0
    odd_sum = 0
    R_i = 0
    L_i = -2
    
    for idx, s in enumerate(S):
        
        if s == 'R':
            R_i = idx
            if L_i+1 == R_i:
                even_odd_sum.append((even_sum, odd_sum))
                even_sum = 0
                odd_sum = 0
        elif s == 'L':
            L_i = idx
            if R_i+1 == idx:
                children_position.append((R_i, L_i))
                
        even_sum += idx % 2 == 0
        odd_sum += idx % 2 == 1
                
    even_odd_sum.append((even_sum, odd_sum))
    # print(children_position, even_odd_sum)
    for idx in range(len(children_position)):
        t = children_position[idx]
        even_odd_R = t[0] % 2
        even_odd_L = t[1] % 2
        
        result[t[0]] = even_odd_sum[idx][0] if even_odd_R == 0 else even_odd_sum[idx][1]
        result[t[1]] = even_odd_sum[idx][0] if even_odd_L == 0 else even_odd_sum[idx][1]
        
    
    print(' '.join(map(str, result)))
solve()