Problem p03998 (python)

Fixed submission:
A = list(str(input()))
B = list(str(input()))
C = list(str(input()))
a_len = len(A)
b_len = len(B)
c_len = len(C)
next = "a"

while a_len>=0 and b_len>=0 and c_len>=0:
    if next=="a":
        if a_len>=1:
            next = A[0]
            del A[0]
        a_len -= 1
    elif next=="b":
        if b_len>=1:
            next = B[0]
            del B[0]
        b_len -= 1
    else:
        if c_len>=1:
            next = C[0]
            del C[0]
        c_len -= 1
print(next.upper())

Buggy submission (verdict: Runtime Error):
A = list(str(input()))
B = list(str(input()))
C = list(str(input()))
a_len = len(A)
b_len = len(B)
c_len = len(C)
next = "A"

while a_len>=0 and b_len>=0 and c_len>=0:
    if next=="A":
        next = A[0]
        del A[0]
        a_len -= 1
    elif next=="B":
        next = B[0]
        del B[0]
        b_len -= 1
    else:
        next = C[0]
        del C[0]
        c_len -= 1
print(next.upper())

Buggy submission (verdict: Runtime Error):
A = list(str(input()))
B = list(str(input()))
C = list(str(input()))
a_len = len(A)
b_len = len(B)
c_len = len(C)
next = "A"

while a_len>=0 and b_len>=0 and c_len>=0:
    if next=="A":
        next = A[0]
        A.pop(0)
        a_len -= 1
    elif next=="B":
        next = B[0]
        A.pop(0)
        b_len -= 1
    else:
        next = C[0]
        B.pop(0)
        c_len -= 1
print(next.upper())

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()
a_len = len(A)
b_len = len(B)
c_len = len(C)
next = "A"

while a_len>=0 and b_len>=0 and c_len>=0:
    if next=="A":
        next = A[0]
        A.pop(0)
        a_len -= 1
    elif next=="B":
        next = B[0]
        A.pop(0)
        b_len -= 1
    else:
        next = C[0]
        B.pop(0)
        c_len -= 1
print(next.upper())

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()
a_len = len(A)
b_len = len(B)
c_len = len(C)
next = "A"

while a_len>=0 and b_len>=0 and c_len>=0:
    if next=="A":
        next = A[0].upper()
        A.pop(0)
        a_len = a_len - 1
    elif next=="B":
        next = B[0].upper()
        A.pop(0)
        b_len = b_len - 1
    else:
        next = C[0].upper()
        B.pop(0)
        c_len = c_len - 1
print(next)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()
a_len = len(A)
b_len = len(B)
c_len = len(C)
next = "A"

while a_len>=0 and b_len>=0 and c_len>=0:
    if next=="A":
        next = A[0].upper()
        A = A[1:-1]
        a_len = a_len - 1
    elif next=="B":
        next = B[0].upper()
        A = A[1:-1]
        b_len = b_len - 1
    else:
        next = C[0].upper()
        B = B[1:-1]
        c_len = c_len - 1
print(next)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()
a_len = len(A)
b_len = len(B)
c_len = len(C)
next = "A"

while a_len>=0 and b_len>=0 and c_len>=0:
    if next=="A":
        next = A[0].upper()
        A = A.pop(0)
        a_len = a_len - 1
    elif next=="B":
        next = B[0].upper()
        A = A.pop(0)
        b_len = b_len - 1
    else:
        next = C[0].upper()
        B = B.pop(0)
        c_len = c_len - 1
print(next)

Buggy submission (verdict: Runtime Error):
A = list(str(input()))
B = list(str(input()))
C = list(str(input()))
a_len = len(A)
b_len = len(B)
c_len = len(C)
next = "A"

while a_len>=0 and b_len>=0 and c_len>=0:
    if next=="A":
        next = A[0].upper()
        A = A.pop(0)
        a_len = a_len - 1
    elif next=="B":
        next = B[0].upper()
        A = A.pop(0)
        b_len = b_len - 1
    else:
        next = C[0].upper()
        B = B.pop(0)
        c_len = c_len - 1
print(next)