Problem p03998 (python)

Fixed submission:
A = input()
B = input()
C = input()

xa = 0
xb = 0
xc = 0

h = 'A'
k = A[0] #最初の１枚を抜く
xa += 1

while True:

    if k == 'a':
        h = 'A'
        if xa < len(A):
            k = A[xa]
            xa += 1
        else:
            break
    elif k == 'b':
        h = 'B'
        xb += 1
        if xb < len(B):
            k = B[xb]
            xb += 1
        else:
            break
    elif k == 'c':
        h = 'C'
        xc += 1
        if xc < len(C):
            k = C[xc]
            xc += 1
        else:
            break

print(h)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()

#配列の次のカードの文字を返す
def next(X, i):
    if X[i] == 'a':
        return A[i]
    elif X[i] == 'b':
        return B[i]
    else:
        return C[i]

xa = 0
xb = 0
xc = 0

h = 'A'
k = next(A, xa) #最初
xa += 1

while xa <= len(A) and xb <= len(B) and xc <= len(C):
    if k == 'a':
        h = 'A'
        k = next(A, xa)
        xa += 1
    elif k == 'b':
        h = 'B'
        k = next(B, xb)
        xb += 1
    else:
        h = 'C'
        k = next(C, xc)
        xc += 1

print(h)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()

#配列の次のカードの文字を返す
def next(X, i):
    if X[i] == 'a':
        return A[i]
    elif X[i] == 'b':
        return B[i]
    else:
        return C[i]

xa = 0
xb = 0
xc = 0

h = 'A'
k = next(A, xa) #最初
xa += 1

while xa < len(A) and xb <len(B) and xc < len(C):
    if k == 'a':
        h = 'A'
        k = next(A, xa)
        xa += 1
    elif k == 'b':
        h = 'B'
        k = next(B, xb)
        xb += 1
    else:
        h = 'C'
        k = next(C, xc)
        xc += 1

print(h)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()

xa = 0
xb = 0
xc = 0

h = 'A'
k = A[0] #最初の１枚を抜く
xa += 1

while True:
    #抜いたカードに書かれている文字に注目
    # 次の手番は A だった
    if k == 'a':
        h = 'A'
        # xa はこの時点で 2、len(A)が 1 なら A の勝ち
        if xa <= len(A):
            k = A[xa]
            xa += 1
        else:
            break
    elif k == 'b':
        h = 'B'
        xb += 1
        if xb <= len(B):
            k = B[xb]
            xb += 1
        else:
            break
    else:
        h = 'C'
        xc += 1
        if xc <= len(C):
            k = C[xc]
            xc += 1
        else:
            break

print(h)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()

xa = 0
xb = 0
xc = 0

while True:
    #抜いたカードに書かれている文字に注目
    # 次の手番は A だった
    if k == 'a':
        h = 'A'
        # xa はこの時点で 2、len(A)が 1 なら A の勝ち
        if xa <= len(A):
            k = A[xa]
            xa += 1
        else:
            break
    elif k == 'b':
        h = 'B'
        xb += 1
        if xb <= len(B):
            k = B[xb]
            xb += 1
        else:
            break
    else:
        h = 'C'
        xc += 1
        if xc <= len(C):
            k = C[xc]
            xc += 1
        else:
            break

print(h)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()

xa = 0
xb = 0
xc = 0

#配列の次のカードの文字を返す
def next(X, i):
    if X[i - 1] == 'a':
        return A[xa]
    elif X[i - 1] == 'b':
        return B[xb]
    else:
        return C[xc]

h = 'A'
xa += 1
k = next(A, xa) #最初

while True:
    if k == 'a':
        h = 'A'
        xa += 1
        if xa <= len(A):
            k = next(A, xa)
        else:
            break
    elif k == 'b':
        h = 'B'
        xb += 1
        if xb <= len(B):
            k = next(B, xb)
        else:
            break
    else:
        h = 'C'
        xc += 1
        if xc <= len(C):
            k = next(C, xc)
        else:
            break

print(h)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()

xa = 0
xb = 0
xc = 0

#配列の次のカードの文字を返す
def next(X, i):
    if X[i - 1] == 'a':
        return A[xa]
    elif X[i - 1] == 'b':
        return B[xb]
    else:
        return C[xc]

h = 'A'
xa += 1
k = next(A, xa) #最初

while True:
    if k == 'a':
        h = 'A'
        xa += 1
        if xa < len(A):
            k = next(A, xa)
        else:
            break
    elif k == 'b':
        h = 'B'
        xb += 1
        if xb < len(B):
            k = next(B, xb)
        else:
            break
    else:
        h = 'C'
        xc += 1
        if xc < len(C):
            k = next(C, xc)
        else:
            break

print(h)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()

xa = 0
xb = 0
xc = 0

#配列の次のカードの文字を返す
def next(X, i):
    if X[i] == 'a':
        return A[xa]
    elif X[i] == 'b':
        return B[xb]
    else:
        return C[xc]

h = 'A'
xa += 1
k = next(A, xa - 1) #最初

while True:
    if k == 'a':
        h = 'A'
        xa += 1
        if xa < len(A):
            k = next(A, xa - 1)
        else:
            break
    elif k == 'b':
        h = 'B'
        xb += 1
        if xb < len(B):
            k = next(B, xb - 1)
        else:
            break
    else:
        h = 'C'
        xc += 1
        if xc < len(C):
            k = next(C, xc - 1)
        else:
            break

print(h)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()

xa = 0
xb = 0
xc = 0

#配列の次のカードの文字を返す
def next(X, i):
    if X[i] == 'a':
        return A[xa]
    elif X[i] == 'b':
        return B[xb]
    else:
        return C[xc]

h = 'A'
xa += 1
k = next(A, xa - 1) #最初

while True:
    if k == 'a':
        h = 'A'
        xa += 1
        if xa <= len(A):
            k = next(A, xa - 1)
        else:
            break
    elif k == 'b':
        h = 'B'
        xb += 1
        if xb <= len(B):
            k = next(B, xb - 1)
        else:
            break
    else:
        h = 'C'
        xc += 1
        if xc <= len(C):
            k = next(C, xc - 1)
        else:
            break

print(h)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()

xa = 0
xb = 0
xc = 0

#配列の次のカードの文字を返す
def next(X, i):
    if X[i] == 'a':
        return A[xa]
    elif X[i] == 'b':
        return B[xb]
    else:
        return C[xc]

h = 'A'
xa += 1
k = next(A, xa - 1) #最初

while True:
    if k == 'a':
        h = 'A'
        xa += 1
        if xa < len(A):
            k = next(A, xa - 1)
    elif k == 'b':
        h = 'B'
        xb += 1
        if xb < len(B):
            k = next(B, xb - 1)
    else:
        h = 'C'
        xc += 1
        if xc < len(C):
            k = next(C, xc - 1)

print(h)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()

xa = 0
xb = 0
xc = 0

#配列の次のカードの文字を返す
def next(X, i):
    if X[i] == 'a':
        return A[xa]
    elif X[i] == 'b':
        return B[xb]
    else:
        return C[xc]

h = 'A'
xa += 1
k = next(A, xa - 1) #最初

while True:
    if k == 'a':
        h = 'A'
        xa += 1
        if xa <= len(A):
            k = next(A, xa - 1)
    elif k == 'b':
        h = 'B'
        xb += 1
        if xb <= len(B):
            k = next(B, xb - 1)
    else:
        h = 'C'
        xc += 1
        if xc <= len(C):
            k = next(C, xc - 1)

print(h)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()

xa = 0
xb = 0
xc = 0

#配列の次のカードの文字を返す
def next(X, i):
    if X[i] == 'a':
        return A[xa]
    elif X[i] == 'b':
        return B[xb]
    else:
        return C[xc]

h = 'A'
xa += 1
k = next(A, xa - 1) #最初

while xa <= len(A) and xb <= len(B) and xc <= len(C):
    if k == 'a':
        h = 'A'
        xa += 1
        k = next(A, xa - 1)
    elif k == 'b':
        h = 'B'
        xb += 1
        k = next(B, xb - 1)
    else:
        h = 'C'
        xc += 1
        k = next(C, xc - 1)

print(h)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()

xa = 0
xb = 0
xc = 0

#配列の次のカードの文字を返す
def next(X, i):
    if X[i] == 'a':
        return A[xa]
    elif X[i] == 'b':
        return B[xb]
    else:
        return C[xc]

h = 'A'
xa += 1
k = next(A, xa - 1) #最初

while xa < len(A) and xb <len(B) and xc < len(C):
    if k == 'a':
        h = 'A'
        xa += 1
        k = next(A, xa - 1)
    elif k == 'b':
        h = 'B'
        xb += 1
        k = next(B, xb - 1)
    else:
        h = 'C'
        xc += 1
        k = next(C, xc - 1)

print(h)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()

def next(X, i):
    if X[i] == 'a':
        return A[i]
    elif X[i] == 'b':
        return B[i]
    else:
        return C[i]

xa = 0
xb = 0
xc = 0


h = 'A'

k = next(A, xa) #最初
xa += 1

while True:
    if k == 'a':
        h = 'A'
        if(len(A) <= xa):
            break
        k = next(A, xa)
        xa += 1
    elif k == 'b':
        h = 'B'
        if(len(B) <= xb):
            break
        k = next(B, xb)
        xb += 1
    else:
        h = 'C'
        if(len(C) <= xc):
            break
        k = next(C, xc)
        xc += 1

print(h)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()

#配列の次のカードの文字を返す
def next(X, i):
    if X[i] == 'a':
        return A[i]
    elif X[i] == 'b':
        return B[i]
    else:
        return C[i]

xa = 0
xb = 0
xc = 0

h = 'A'
k = next(A, xa) #最初
xa += 1

while xa <= len(A) and xb <= len(B) and xc <= len(C):
    if k == 'a':
        h = 'A'
        k = next(A, xa)
        xa += 1
    elif k == 'b':
        h = 'B'
        k = next(B, xb)
        xb += 1
    else:
        h = 'C'
        k = next(C, xc)
        xc += 1

print(h)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()

#配列の次のカードの文字を返す
def next(X, i):
    if X[i] == 'a':
        return A[i]
    elif X[i] == 'b':
        return B[i]
    else:
        return C[i]

xa = 0
xb = 0
xc = 0

h = 'A'
k = next(A, xa) #最初
xa += 1

while xa < len(A) and xb <len(B) and xc < len(C):
    if k == 'a':
        h = 'A'
        k = next(A, xa)
        xa += 1
    elif k == 'b':
        h = 'B'
        k = next(B, xb)
        xb += 1
    else:
        h = 'C'
        k = next(C, xc)
        xc += 1

print(h)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()

#配列の次のカードの文字を返す
def next(X, i):
    if X[i] == 'a':
        return A[i+1]
    elif X[i] == 'b':
        return B[i+1]
    else:
        return C[i+1]

xa = 0
xb = 0
xc = 0

h = 'A'
k = next(A, xa) #最初
xa += 1

while xa < len(A) and xb <len(B) and xc < len(C):
    if k == 'a':
        h = 'A'
        k = next(A, xa)
        xa += 1
    elif k == 'b':
        h = 'B'
        k = next(B, xb)
        xb += 1
    else:
        h = 'C'
        k = next(C, xc)
        xc += 1

print(h)