t=int(input())
for i in range(0,t):
    n,m=map(int,input().rstrip().split())
    n=str(n)
    m=str(m)
    m=m*len(n)
    i=0
    t=[]
    k=""
    for i in range(0,len(n)):
    
        t.append(int(n[i])+int(m[i]))
    k = ''.join([str(elem) for elem in t])
    print(len(k))



