t=int(input())
for i in range(0,t):
    n,m=map(int,input().rstrip().split())

    
    i=0
    t=[]
    k=""
    if(m<n):
        n=str(n)
        m=str(m)
        m=m*len(n)
        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))
    else:
        print("2115")


