#*************************************************
#       School:Longfellow Middle School
#       Name:Teddy Winston
#       Grade:8th
#       Division:INT-3
#       Program Language: Python
#*************************************************
def maxi(a,b):
    if len(a)>len(b):
        return a
    return b
def mini(a,b):
    if len(a)>len(b):
        return b
    return a

def delChar2(a,b):
    minl = min(len(a),len(b))
    new_a = ""
    new_b = ""
    for i in range(minl):
        if a[i] != b[i]:
           new_a += a[i]
           new_b += b[i]
    new_a += a[minl:]
    new_b += b[minl:]
    return(new_a,new_b)

def delChar(a,b):
    '''Delete all similar characters'''
    while True:
        delList =[]
        for i in range(len(mini(a,b))):
            if a[i] == b[i]:
                delList.insert(0,i)
        if len(delList) != 0:
            a = list(a)
            b = list(b)
            for i in delList:
                del a[i]
                del b[i]
            ''.join(a)
            ''.join(b)
            a,b = delChar2(a,b)
        else:
            return a,b

def delTwice2(a,b):
    minl = min(len(a),len(b))
    for i in range(minl-1):
        if b[i+1] == a[i]:
            return a,(b[:i]+b[(i+1):])
        elif a[i+1] == b[i]:
            return(a[:i]+a[(i+1):],b)
    return(a,b)

def delTwice(a,b):
    '''To be used in the case that you can delete a character to get a match'''
    a = list(a)
    b = list(b)
    delList1 = []
    delList2 = []
    while True:
        delList1 = []
        delList2 = []
        while True:
            delList1 = []
            for i in range(len(mini(a, b))):
                if i != len(mini(a,b))-1:
                    if a[i+1] == b[i]:
                        delList1.insert(0,i)
                        break
            if len(delList1) != 0:
                for i in delList1:
                    del a[i+1]
                    del a[i]
                    del b[i]
                    a,b = delChar2(''.join(a),''.join(b))
                    a = list(a)
                    b = list(b)
            else:
                break
        while True:
            delList2 =[]
            for i in range(len(mini(a, b))):
                if i != len(mini(a,b))-1:
                    if b[i+1] == a[i]:
                        delList2.insert(0,i)
                        break
            if len(delList2) != 0:
                for i in delList2:
                    del a[i]
                    del b[i+1]
                    del b[i]
                    a,b = delChar2(''.join(a),''.join(b))
                    a = list(a)
                    b = list(b)
            else:
                break
        if len(delList1) == 0 and len(delList2) == 0:
            ''.join(a)
            ''.join(b)
            return a,b
            
 


linenum = 0
txt = input("What file?:  ")
inp = open(txt+'.txt',"r")
while True:
    linenum += 1
    if linenum == 6:
        break
    num = 0
    line = inp.readline()
    part = line.split()
    a = part[0]
    b = part[1]
    delchar = False
    while True:
        delchar = False
        for i in range(len(mini(a,b))):
            if i != len(mini(a,b)) -1:
                if a[i] == b[i+1] or a[i] == b[i] or a[i+1] == b[i]:
                    delchar = True
        if delchar:
            a,b = delChar2(a,b)
            a,b = delTwice2(a,b)
        else:
            break
    for i in range(len(mini(a,b))):
        num += ord(a[i]) - ord(b[i])
    num += abs(len(a)-len(b))
    print(num)