A,B=map(str,input().split())        # let's begin by casting strings to strings!

while(int(A)!=0 and int(B)!=0):

    tamanhoa=0
    tamanhob=0

    for i in range(len(A)):
        tamanhoa+=1                 # wonderful way to determine the length of
                                    # a string!
    for i in range(len(B)):
        tamanhob+=1

    vA = [0]*tamanhoa
    vB = [0]*tamanhob

    if tamanhoa>tamanhob:
        vA = [0]*tamanhoa           # Just to make sure it really gets set!!!
        vB = [0]*tamanhoa

        for i in range(tamanhoa-1,-1,-1):
            vA[i]=int(A[i])         # he even saved an operation by casting
                                    # the char to int at the same time!
        for i in range(tamanhob):
            vB[i+1]=int(B[i])
    elif tamanhoa<tamanhob:
        vA = [0]*tamanhob           # Just to make sure it really gets set!!!
        vB = [0]*tamanhob

        for i in range(tamanhoa):
            vA[i+1]=int(A[i])

        for i in range(tamanhob-1,-1,-1):
            vB[i]=int(B[i])

        tamanhoa=tamanhob

    else:
        for i in range(tamanhoa):
            vA[i]=int(A[i])

        for i in range(tamanhob):
            vB[i]=int(B[i])

    print(vA)
    print(vB)
    
    carry = 0

    for i in range(tamanhoa-1,-1,-1):
        soma = vA[i] + vB[i]
        if soma > 9:
            carry += 1
            if vA[i-1]!= 9:
                vA[i-1] += 1
            else:
                vB[i-1] +=1


    if carry == 0:
        print('No carry operation.')
    elif carry == 1:
        print(carry, 'carry operation.')
    else:
        print(carry, 'carry operations.')

    A,B=map(str,input().split())    # why bother casting strings to int? yay

    if int(A)==0 and int(B)==0:
        break

This wonder was found within answers to a university programming test. Code as-is, comments added by me.

By Anonymous, 2017-12-14 00:09:27