"""
Arjun Nair
Bergen County Academies
Intermediate Division
"""

inp = open("2int_sampledata.txt", "r").readlines()
for line in inp:
    stringOne, stringTwo = (list(i) for i in line.split())
    pointerLocation = 0
    shorterLen = len(stringOne) if len(stringOne) < len(stringTwo) else len(stringTwo)
    nothingDone = False
    while not nothingDone:
        nothingDone = True
        pointerLocation = 0
        shorterLen = len(stringOne) if len(stringOne) < len(stringTwo) else len(stringTwo)
        x = 0
        while x < shorterLen:
            if stringOne[x] == stringTwo[x]:
                del stringTwo[x]
                del stringOne[x]
                shorterLen -= 1
                x -= 1
                nothingDone = False
            x += 1
        while pointerLocation < shorterLen:
            if pointerLocation + 1 < len(stringTwo):
                if stringTwo[pointerLocation+1] == stringOne[pointerLocation]:
                    del stringTwo[pointerLocation]
                    nothingDone = False
                    break
                elif pointerLocation + 1 < len(stringOne):
                    if stringOne[pointerLocation+1] == stringTwo[pointerLocation]:
                        del stringOne[pointerLocation]
                        nothingDone = False
                        break
            pointerLocation += 1


    # calculate acsl sameness factor
    shorterStr = stringOne if len(stringOne) < len(stringTwo) else stringTwo
    longerStr = stringOne if shorterStr == stringTwo else stringTwo
    #print(shorterStr)
    #print(longerStr)
    sum = len(longerStr) - len(shorterStr)
    for i in range(len(shorterStr)):
        sum += ord(stringOne[i]) - ord(stringTwo[i])


    print(sum)