#Takoma Park M.S.
#Int-3
#Contest 2
#Isabelle Yang

def leftalign(x,y):
    new1,new2 = "s","s"
    n1,n2 = "",""
    while new1 != n1 or new2 != n2:
        loop = 0
        n1, n2 = "", ""
        if len(x) > len(y):length = y
        else:length = x
            
        for i in range(0,len(length)):
            if x[i] != y[i]:
                n1 = n1 + x[i]
                n2 = n2 + y[i]
        if len(x) > len(y):n1 += x[i+1:]
        elif len(y) > len(x):n2 += y[i+1:]
        
        new1,new2 = "",""
        
        if len(n1) > len(n2):length = n2
        else:length = n1

        if len(n1) == 1 and len(n2) == 1:
            new1 = n1
            new2 = n2
            break
        
        for i in range(0,len(length)-1):
            if n1[i] == n2[i+1]:
                new1+= n1[i:]
                new2 += n2[i+1:]
                loop += 1
                break
            elif n2[i] == n1[i+1]:
                new1 += n1[i+1:]
                new2 += n2[i:]
                loop += 1
                break 
            else:
                new1 += n1[i]
                new2 += n2[i]

        if loop == 1:
            x,y = new1, new2
        
        elif loop != 1:
            if len(n1) > len(n2):
                new1 += n1[i+1:]
                new2 += n2[i+1]
            elif len(n1) < len(n2):
                new2 += n2[i+1:]
                new1 += n1[i+1]
            elif len(n1) == len(n2):
                new1 += n1[i+1:]
                new2 += n2[i+1:]
            elif len(n1) == len(n2) and len(n1) == 1:
                new1 += n1[0]
                new2 += n2[0]
        
        x,y = new1,new2

    return new1,new2;

def ACSL(x,y):
    total = 0
    if len(x)>len(y):length = y
    else:length = x
        
    for i in range(0,len(length)):
        if ord(y[i]) > ord(x[i]):total -= ord(y[i])-ord(x[i])
        else:total += ord(x[i]) - ord(y[i])
            
    if len(x) == 1 and len(y) == 1:
         if ord(y[0]) > ord(x[0]):total = ord(x[0])-ord(y[0])
         else:total = ord(y[0]) - ord(x[0])
            
    if len(x)>len(y):total += len(x)-len(y)
    elif len(y) >len(x):total += len(y)-len(x)
    return total;
    
f = open("2int_testdata.txt", "r")
for line in f:
    data = line.split()
    wordOne, wordTwo = data[0], data[1]
    left = leftalign(wordOne,wordTwo)
    wordOne, wordTwo = left[0], left[1]
    sameFactor = ACSL(wordOne,wordTwo)
    print(sameFactor)
        
f.close()