# Task
 Two integer numbers are added using the column addition method. When using this method, some additions of digits produce non-zero carries to the next positions. Your task is to calculate the number of non-zero carries that will occur while adding the given numbers.

 The numbers are added in base 10.

# Example

 For `a = 543 and b = 3456,` the output should be `0`
 
 For `a = 1927 and b = 6426`, the output should be `2`
 
 For `a = 9999 and b = 1`, the output should be `4`
 
 
# Input/Output


 - `[input]` integer `a`

  A positive integer.

  Constraints: `1 ≤ a ≤ 10^7`


 - `[input]` integer `b`

  A positive integer.

  Constraints: `1 ≤ b ≤ 10^7`

 
 - `[output]` an integer

Difficulty: introductory

Starter code:

def number_of_carries(a, b):
	

Solutions:
def number_of_carries(a, b):
    ans, carrie = 0, 0
    while a > 0 or b > 0:
        carrie = (a%10 + b%10 + carrie) // 10 
        ans += [0,1][carrie > 0]
        a //= 10
        b //= 10
    return ans

def number_of_carries(a, b):
    i=1
    carry_over=0
    counter=0
    length1=len(str(a))
    length2=len(str(b))
    if length1>length2:
        while length2-i>=0:
            if int(str(a)[length1-i])+int(str(b)[length2-i])+carry_over>=10:
                counter+=1
                carry_over=1
                i+=1
            else:
                carry_over=0
                i+=1
        while length1-i>=0:
            if int(str(a)[length1-i])+carry_over>=10:
                counter+=1
                carry_over=1
                i+=1
            else:
                carry_over=0
                i+=1
    elif length2>length1:
        while length1-i>=0:
            if int(str(a)[length1-i])+int(str(b)[length2-i])+carry_over>=10:
                counter+=1
                carry_over=1
                i+=1
            else:
                carry_over=0
                i+=1
        while length2-i>=0:
            if int(str(b)[length2-i])+carry_over>=10:
                counter+=1
                carry_over=1
                i+=1
            else:
                carry_over=0
                i+=1
    elif length2==length1:
        while length1-i>=0:
            if int(str(a)[length1-i])+int(str(b)[length2-i])+carry_over>=10:
                counter+=1
                carry_over=1
                i+=1
            else:
                carry_over=0
                i+=1
    return counter
    


def number_of_carries(a, b):
    a, b, c, r = [int(x) for x in f"000000{a}"], [int(x) for x in f"000000{b}"], 0, 0
    for x, y in zip(reversed(a), reversed(b)):
        c = x + y + c > 9
        r += c
    return r

from itertools import zip_longest
help = lambda n: map(int, reversed(str(n)))

def number_of_carries(a, b):
    carry = res = 0
    for x,y in zip_longest(help(a), help(b), fillvalue=0):
        tmp = x + y + carry
        res += tmp > 9
        carry = tmp // 10
    return res

from itertools import zip_longest
def number_of_carries(a, b):
    carry,li = [0],[]
    for i, j in zip_longest(str(a)[::-1], str(b)[::-1], fillvalue='0'):
        s = int(i) + int(j) + carry[-1]
        li.append(s % 10)
        if s > 9 : carry.append(int(str(s)[0])) ; continue
        carry.append(0)
    return carry.count(1)

from itertools import zip_longest

def number_of_carries(a, b):
    x, y = str(a)[::-1], str(b)[::-1]
    result = c = 0
    for a, b in zip_longest(map(int, x), map(int, y), fillvalue=0):
        c = (a + b + c) > 9
        result += c
    return result

def number_of_carries(a, b):
    a, b = str(a)[::-1], str(b)[::-1]
    l = max(len(a), len(b))
    carry, carries = 0, 0
    for col in [int(m)+int(n) for m, n in zip(f"{a:<0{l}s}", f"{b:<0{l}s}")]:
        carry = (col + carry) > 9
        carries += carry
    return carries

def number_of_carries(a, b):
    # Reverse and align
    a, b = str(a)[::-1], str(b)[::-1]
    while len(a) < len(b):
        a += '0'
    while len(a) > len(b):
        b += '0'
    # Perform base 10 addition
    carry, carries = 0, 0
    for ad, bd in zip(a, b):
        ad, bd = int(ad), int(bd)
        nd = ad + bd + carry
        if nd > 9:
            carry = (nd - (nd % 10)) // 10
            carries += 1
        else:
            carry = 0
    return carries


def number_of_carries(a, b):
    c = [0]
    while a or b:
        c, a, b = c + [(c[-1] + a % 10 + b % 10) // 10], a // 10, b // 10
    return sum(c)

number_of_carries=r=lambda a,b,c=0:a+b+c and c+r(a//10,b//10,a%10+b%10+c>9)