Buggy python submission (verdict: Time Limit Exceeded):
s = input()
# print(s)
t = s.replace("LR","L,R")
# print(t)
u = t.split(",")
# print(u)
ans = []
for i in u:
    L = len(i)
    # print(u[i])
    j = i.find("RL")
    # print(j)
    numR = j+1
    numL = L-(j+1)
    a = [0]*L
    a[j] = (numR+1)//2 + (numL)//2
    a[j+1] = (numR)//2 + (numL+1)//2
    ans = ans + a
print(" ".join(map(str, ans)))

Fixed submission:
s = input()
l = len(s)
ans = [0]*l
count = 0
for i in range(l):
    if s[i]=="R" and s[i+1]=="R":
        count += 1
    elif s[i]=="R" and s[i+1]=="L":
        count += 1
        ans[i] += (count+1)//2
        ans[i+1] += count//2
        count = 0
for i in reversed(range(l)):
    # print(i)
    # print(s[i])
    if s[i]=="L" and s[i-1]=="L":
        count += 1
    elif s[i]=="L" and s[i-1]=="R":
        count += 1
        ans[i] += (count+1)//2
        ans[i-1] += count//2
        count = 0
print(" ".join(map(str, ans)))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = s.replace("LR","L,R")
# print(t)
u = t.split(",")
# print(u)
ans = []
for i in range(len(u)):
    # print(u[i])
    j = u[i].find("RL")
    # print(j)
    numR = j+1
    numL = len(u[i])-(j+1)
    a = [0]*len(u[i])
    a[j] = (numR+1)//2 + (numL)//2
    a[j+1] = (numR)//2 + (numL+1)//2
    ans = ans + a
print(" ".join(map(str, ans)))

Fixed submission:
s = input()
l = len(s)
ans = [0]*l
count = 0
for i in range(l):
    if s[i]=="R" and s[i+1]=="R":
        count += 1
    elif s[i]=="R" and s[i+1]=="L":
        count += 1
        ans[i] += (count+1)//2
        ans[i+1] += count//2
        count = 0
for i in reversed(range(l)):
    # print(i)
    # print(s[i])
    if s[i]=="L" and s[i-1]=="L":
        count += 1
    elif s[i]=="L" and s[i-1]=="R":
        count += 1
        ans[i] += (count+1)//2
        ans[i-1] += count//2
        count = 0
print(" ".join(map(str, ans)))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = s.replace("LR","L,R")
# print(t)
u = t.split(",")
# print(u)
ans = []
for i in range(len(u)):
    # print(u[i])
    j = u[i].find("RL")
    # print(j)
    numR = j+1
    numL = len(u[i])-(j+1)
    a = [0]*len(u[i])
    a[j] = (numR+1)//2 + (numL)//2
    a[j+1] = (numR)//2 + (numL+1)//2
    ans = ans + a
print(" ".join(map(str, ans)))

Fixed submission:
s = input()
l = len(s)
ans = [0]*l
count = 0
for i in range(l):
    if s[i]=="R" and s[i+1]=="R":
        count += 1
    elif s[i]=="R" and s[i+1]=="L":
        count += 1
        ans[i] += (count+1)//2
        ans[i+1] += count//2
        count = 0
for i in reversed(range(l)):
    # print(i)
    # print(s[i])
    if s[i]=="L" and s[i-1]=="L":
        count += 1
    elif s[i]=="L" and s[i-1]=="R":
        count += 1
        ans[i] += (count+1)//2
        ans[i-1] += count//2
        count = 0
print(" ".join(map(str, ans)))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = s.replace("LR","L,R")
# print(t)
u = t.split(",")
# print(u)
ans = []
for i in range(len(u)):
    # print(u[i])
    j = u[i].find("RL")
    # print(j)
    numR = j+1
    numL = len(u[i])-(j+1)
    a = [0]*len(u[i])
    a[j] = (numR+1)//2 + (numL)//2
    a[j+1] = (numR)//2 + (numL+1)//2
    ans = ans + a
print(" ".join(list(map(str, ans))))

Fixed submission:
s = input()
l = len(s)
ans = [0]*l
count = 0
for i in range(l):
    if s[i]=="R" and s[i+1]=="R":
        count += 1
    elif s[i]=="R" and s[i+1]=="L":
        count += 1
        ans[i] += (count+1)//2
        ans[i+1] += count//2
        count = 0
for i in reversed(range(l)):
    # print(i)
    # print(s[i])
    if s[i]=="L" and s[i-1]=="L":
        count += 1
    elif s[i]=="L" and s[i-1]=="R":
        count += 1
        ans[i] += (count+1)//2
        ans[i-1] += count//2
        count = 0
print(" ".join(map(str, ans)))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()

ans = []
p = s.count("LR")
# print(p)
for i in range(p+1):
    k = s.find("LR")
    if k==-1:
        k=len(s)-1
    a = [0]*(k+1)
    numR = s[:k+1].count("R")
    numL = k+1-numR
    l = numR-1
    a[l] = (numR+1)//2 + (numL)//2
    a[l+1] = (numR)//2 + (numL+1)//2
    ans = ans + a
    s = s[k+1:]

print(" ".join(list(map(str, ans))))

Fixed submission:
s = input()
l = len(s)
ans = [0]*l
count = 0
for i in range(l):
    if s[i]=="R" and s[i+1]=="R":
        count += 1
    elif s[i]=="R" and s[i+1]=="L":
        count += 1
        ans[i] += (count+1)//2
        ans[i+1] += count//2
        count = 0
for i in reversed(range(l)):
    # print(i)
    # print(s[i])
    if s[i]=="L" and s[i-1]=="L":
        count += 1
    elif s[i]=="L" and s[i-1]=="R":
        count += 1
        ans[i] += (count+1)//2
        ans[i-1] += count//2
        count = 0
print(" ".join(map(str, ans)))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()

ans = []
k = s.find("LR")
while k!=-1:
    t = s[:k+1]
    a = [0]*(k+1)
    numR = t.count("R")
    numL = k+1-numR
    l = numR-1
    a[l] = (numR+1)//2 + (numL)//2
    a[l+1] = (numR)//2 + (numL+1)//2
    ans = ans + a
    s = s[k+1:]
    k = s.find("LR")

a = [0]*len(s)
numR = s.count("R")
numL = len(s)-numR
l = numR-1
a[l] = (numR+1)//2 + (numL)//2
a[l+1] = (numR)//2 + (numL+1)//2
ans = ans + a
print(" ".join(list(map(str, ans))))

Fixed submission:
s = input()
l = len(s)
ans = [0]*l
count = 0
for i in range(l):
    if s[i]=="R" and s[i+1]=="R":
        count += 1
    elif s[i]=="R" and s[i+1]=="L":
        count += 1
        ans[i] += (count+1)//2
        ans[i+1] += count//2
        count = 0
for i in reversed(range(l)):
    # print(i)
    # print(s[i])
    if s[i]=="L" and s[i-1]=="L":
        count += 1
    elif s[i]=="L" and s[i-1]=="R":
        count += 1
        ans[i] += (count+1)//2
        ans[i-1] += count//2
        count = 0
print(" ".join(map(str, ans)))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()

ans = []
k = s.find("LR")
while k!=-1:
    t = s[:k+1]
    a = [0]*(k+1)
    numR = t.count("R")
    numL = k+1-numR
    l = numR-1
    a[l] = (numR+1)//2 + (numL)//2
    a[l+1] = (numR)//2 + (numL+1)//2
    ans = ans + a
    s = s[k+1:]
    k = s.find("LR")

a = [0]*len(s)
numR = s.count("R")
numL = len(s)-numR
l = numR-1
a[l] = (numR+1)//2 + (numL)//2
a[l+1] = (numR)//2 + (numL+1)//2
ans = ans + a
print(" ".join(list(map(str, ans))))

Fixed submission:
s = input()
l = len(s)
ans = [0]*l
count = 0
for i in range(l):
    if s[i]=="R" and s[i+1]=="R":
        count += 1
    elif s[i]=="R" and s[i+1]=="L":
        count += 1
        ans[i] += (count+1)//2
        ans[i+1] += count//2
        count = 0
for i in reversed(range(l)):
    # print(i)
    # print(s[i])
    if s[i]=="L" and s[i-1]=="L":
        count += 1
    elif s[i]=="L" and s[i-1]=="R":
        count += 1
        ans[i] += (count+1)//2
        ans[i-1] += count//2
        count = 0
print(" ".join(map(str, ans)))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()

ans = []
k = s.find("LR")
while k!=-1:
    t = s[:k+1]
    a = [0]*len(s[:k+1])
    numR = t.count("R")
    numL = t.count("L")
    l = numR-1
    a[l] = (numR+1)//2 + (numL)//2
    a[l+1] = (numR)//2 + (numL+1)//2
    ans = ans + a
    s = s[k+1:]
    k = s.find("LR")

a = [0]*len(s)
numR = s.count("R")
numL = s.count("L")
l = numR-1
a[l] = (numR+1)//2 + (numL)//2
a[l+1] = (numR)//2 + (numL+1)//2
ans = ans + a
print(" ".join(list(map(str, ans))))

Fixed submission:
s = input()
l = len(s)
ans = [0]*l
count = 0
for i in range(l):
    if s[i]=="R" and s[i+1]=="R":
        count += 1
    elif s[i]=="R" and s[i+1]=="L":
        count += 1
        ans[i] += (count+1)//2
        ans[i+1] += count//2
        count = 0
for i in reversed(range(l)):
    # print(i)
    # print(s[i])
    if s[i]=="L" and s[i-1]=="L":
        count += 1
    elif s[i]=="L" and s[i-1]=="R":
        count += 1
        ans[i] += (count+1)//2
        ans[i-1] += count//2
        count = 0
print(" ".join(map(str, ans)))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()

ans = []
while s.find("LR")!=-1:
    k = s.find("LR")
    t = s[:k+1]
    a = [0]*len(s[:k+1])
    l = t.find("RL")
    numR = t.count("R")
    numL = t.count("L")
    a[l] = (numR+1)//2 + (numL)//2
    a[l+1] = (numR)//2 + (numL+1)//2
    ans = ans + a
    s = s[k+1:]

a = [0]*len(s)
l = s.find("RL")
numR = s.count("R")
numL = s.count("L")
a[l] = (numR+1)//2 + (numL)//2
a[l+1] = (numR)//2 + (numL+1)//2
ans = ans + a
print(" ".join(list(map(str, ans))))

Fixed submission:
s = input()
l = len(s)
ans = [0]*l
count = 0
for i in range(l):
    if s[i]=="R" and s[i+1]=="R":
        count += 1
    elif s[i]=="R" and s[i+1]=="L":
        count += 1
        ans[i] += (count+1)//2
        ans[i+1] += count//2
        count = 0
for i in reversed(range(l)):
    # print(i)
    # print(s[i])
    if s[i]=="L" and s[i-1]=="L":
        count += 1
    elif s[i]=="L" and s[i-1]=="R":
        count += 1
        ans[i] += (count+1)//2
        ans[i-1] += count//2
        count = 0
print(" ".join(map(str, ans)))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()

# n = s.count("LR")
# print(n)
ans = []
while s.find("LR")!=-1:
    k = s.find("LR")
    t = s[:k+1]
    # print(t)
    a = [0]*len(s[:k+1])
    l = t.find("RL")
    # print(l)
    numR = t.count("R")
    # print(numR)
    numL = t.count("L")
    # print(numL)
    a[l] = (numR+1)//2 + (numL)//2
    a[l+1] = (numR)//2 + (numL+1)//2
    ans = ans + a
    # print(ans)
    s = s[k+1:]

# print(s)

a = [0]*len(s)
l = s.find("RL")
# print(l)
numR = s.count("R")
# print(numR)
numL = s.count("L")
# print(numL)
a[l] = (numR+1)//2 + (numL)//2
a[l+1] = (numR)//2 + (numL+1)//2
ans = ans + a
print(" ".join(list(map(str, ans))))

Fixed submission:
s = input()
l = len(s)
ans = [0]*l
count = 0
for i in range(l):
    if s[i]=="R" and s[i+1]=="R":
        count += 1
    elif s[i]=="R" and s[i+1]=="L":
        count += 1
        ans[i] += (count+1)//2
        ans[i+1] += count//2
        count = 0
for i in reversed(range(l)):
    # print(i)
    # print(s[i])
    if s[i]=="L" and s[i-1]=="L":
        count += 1
    elif s[i]=="L" and s[i-1]=="R":
        count += 1
        ans[i] += (count+1)//2
        ans[i-1] += count//2
        count = 0
print(" ".join(map(str, ans)))