t=int(input())

arr=[]

for i in range(t):
    a,b = input().split()
    a = list(map(int, a))

    res=[a[i]+int(b) for i in range(len(a))]
    res=''.join(map(str, res))
    arr.append(len(res))

for i in arr:
    print(i)