Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding:utf-8 -*-
S = list(input())

loop_idx = 0
loop_len = -(-len(S)//2)
cnt = 0

if len(S) == 1:
    pass
else:
    while loop_idx < loop_len:
        """
        if S[0] == "W":
                S.pop(0)
        if S[-1] == "B":
                S.pop(-1)
        """
        for i in range(len(S)-1,loop_idx,-1):
            if S[i]=="W" and S[i-1] == "B":
                cnt += 1
                S[i],S[i-1] = "B","W"
        loop_idx += 1
        #print(S)
print(cnt)

Fixed submission:
# -*- coding:utf-8 -*-
S = list(input())

cnt_b = 0 
ans = 0

for i in range(len(S)):
    if S[i] == "B":
        cnt_b += 1
    if S[i] == "W":
        ans += cnt_b
print(ans)

Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
S = list(input())

loop_idx = 0
loop_len = -(-len(S)//2)
cnt = 0

if len(S) == 1:
    pass
else:
    while loop_idx < loop_len:
        while True:
            if S[0] == "W":
                S.pop(0)
            else:
                break
        while True:
            if S[-1] == "B":
                S.pop(-1)
            else:
                break
        for i in range(len(S)-1,0,-1):
            if S[i]=="W" and S[i-1] == "B":
                cnt += 1
                S[i],S[i-1] = "B","W"
        loop_idx += 1
        #print(S)
print(cnt)

Fixed submission:
# -*- coding:utf-8 -*-
S = list(input())

cnt_b = 0 
ans = 0

for i in range(len(S)):
    if S[i] == "B":
        cnt_b += 1
    if S[i] == "W":
        ans += cnt_b
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding:utf-8 -*-
S = list(input())

loop_idx = 0
loop_len = -(-len(S)//2)
cnt = 0

if len(S) == 1:
    pass
else:
    while loop_idx < loop_len:
        if S[0] == "W":
            S.pop(0)
        if S[-1] == "B":
            S.pop(-1)
        for i in range(len(S)-1,0,-1):
            if S[i]=="W" and S[i-1] == "B":
                cnt += 1
                S[i],S[i-1] = "B","W"
        loop_idx += 1
print(cnt)

Fixed submission:
# -*- coding:utf-8 -*-
S = list(input())

cnt_b = 0 
ans = 0

for i in range(len(S)):
    if S[i] == "B":
        cnt_b += 1
    if S[i] == "W":
        ans += cnt_b
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding:utf-8 -*-
S = list(input())

loop_idx = 0
cnt = 0

if len(S) == 1:
    pass
else:
    while loop_idx < -(-len(S)//2):
        for i in range(len(S)-1,0,-1):
            if S[i]=="W" and S[i-1] == "B":
                cnt += 1
                S[i],S[i-1] = "B","W"
        loop_idx += 1
print(cnt)

Fixed submission:
# -*- coding:utf-8 -*-
S = list(input())

cnt_b = 0 
ans = 0

for i in range(len(S)):
    if S[i] == "B":
        cnt_b += 1
    if S[i] == "W":
        ans += cnt_b
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding:utf-8 -*-
S = list(input())

loop_idx = 0
cnt = 0

if len(S) == 1:
    pass
else:
    while loop_idx < -(-len(S)//2):
        for i in range(len(S)-1,0,-1):
            if S[i]=="W" and S[i-1] == "B":
                cnt += 1
                S[i],S[i-1] = "B","W"
        loop_idx += 1
print(cnt)

Fixed submission:
# -*- coding:utf-8 -*-
S = list(input())

cnt_b = 0 
ans = 0

for i in range(len(S)):
    if S[i] == "B":
        cnt_b += 1
    if S[i] == "W":
        ans += cnt_b
print(ans)