Buggy python submission (verdict: Runtime Error):
list1=list(input())
list1.reverse()
count=0
for i in range(len(list1)):
    if list1[i]=="W":
        a=i
        break
for i in range(a+1,len(list1)):
    if list1[i]=="B":
        count+=i-a
        a+=1
print(count)

Fixed submission:
list1=list(input())
list1.reverse()
a=0
count=0
for i in range(len(list1)):
    if list1[i]=="W":
        a=i
        break
for i in range(a,len(list1)):
    if list1[i]=="B":
        count+=i-a
        a+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
list1=list(input())
count=0
fin=0
while fin==0 and len(list1)>1:
    frug=0
    for i in range(len(list1)-1):
        if list1[i]=="B" and list1[i+1]=="W":
            count+=1
            list1[i]="W"
            list1[i+1]="B"
            frug=1
        if i==len(list1)-2 and frug==0:
            fin=1
print(count)

Fixed submission:
list1=list(input())
list1.reverse()
a=0
count=0
for i in range(len(list1)):
    if list1[i]=="W":
        a=i
        break
for i in range(a,len(list1)):
    if list1[i]=="B":
        count+=i-a
        a+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
list1=list(input())
count=0
fin=0
while fin==0 and len(list1)>1:
    for i in range(len(list1)-1):
        if list1[i]=="B" and list1[i+1]=="W":
            count+=1
            list1[i]="W"
            list1[i+1]="B"
            break
        if i==len(list1)-2:
            fin=1
print(count)

Fixed submission:
list1=list(input())
list1.reverse()
a=0
count=0
for i in range(len(list1)):
    if list1[i]=="W":
        a=i
        break
for i in range(a,len(list1)):
    if list1[i]=="B":
        count+=i-a
        a+=1
print(count)

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


def main():
    """Function."""
    s = str(input())

    total = 0
    for i in range(len(s)):
        if s[i] == "B":
            total += s[i+1:].count("W")

    print(total)


if __name__ == "__main__":
    main()


Fixed submission:
# -*- coding: utf-8 -*-


def main():
    """Function."""
    s = str(input())

    total = 0
    b_count = 0
    for i in range(len(s)):
        if s[i] == "B":
            b_count += 1
        if s[i] == "W":
            total += b_count

    print(total)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


def main():
    """Function."""
    s = str(input())
    num = len(s)

    total = 0
    s_list = list(s)
    for _ in range(num):
        if s_list == []:
            break

        b_c, w_c = 0, -1
        while s_list[b_c] == "W":
            b_c += 1
        while s_list[w_c] == "B":
            w_c -= 1
        if b_c == 0:
            pass
        else:
            del s_list[:b_c]
        if w_c == -1:
            pass
        else:
            del s_list[w_c+1:]

        if s_list == []:
            break

        for i in range(num-1):
            end = num - i
            start = end - 2
            if s_list[start:end] == ["B", "W"]:
                total += 1
                s_list[start:end] = ["W", "B"]
    print(total)


if __name__ == "__main__":
    main()


Fixed submission:
# -*- coding: utf-8 -*-


def main():
    """Function."""
    s = str(input())

    total = 0
    b_count = 0
    for i in range(len(s)):
        if s[i] == "B":
            b_count += 1
        if s[i] == "W":
            total += b_count

    print(total)


if __name__ == "__main__":
    main()

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


def main():
    """Function."""
    s = str(input())
    num = len(s)

    total = 0
    s_list = list(s)
    for _ in range(num):
        for i in range(num-1):
            end = num - i
            start = end - 2
            if s_list[start:end] == ["B", "W"]:
                total += 1
                s_list[start:end] = ["W", "B"]
    print(total)


if __name__ == "__main__":
    main()


Fixed submission:
# -*- coding: utf-8 -*-


def main():
    """Function."""
    s = str(input())

    total = 0
    b_count = 0
    for i in range(len(s)):
        if s[i] == "B":
            b_count += 1
        if s[i] == "W":
            total += b_count

    print(total)


if __name__ == "__main__":
    main()