#Jono Jenkens
#Cary Academy INT-3
#ACSL Contest 2

f = open('file.txt').readlines()
for x in f:
    x = x.rstrip('\n').split(" ")
    a = x[0]
    b = x[1]
    while True:
        y = 0
        locations = []
        for z in b:
            if y >= len(a):
                break
            if z == a[y]:
                locations.append(y)
            y += 1
        if len(locations) == 0:
            break
        for i in range(len(locations)):
            a = a[:locations[i]] + a[locations[i]+1:]
            b = b[:locations[i]] + b[locations[i]+1:]
            locations = [z-1 for z in locations]
        y = 1
        if len(b) > len(a):
            while y < len(a) and y < len(b):
                if a[y-1] == b[y]:
                    b = b[:y-1] + b[y:]
                    break
                elif a[y] == b[y-1]:
                    a = a[:y-1] + a[y:]
                    break
                y += 1
        elif len(a) > len(b):
            while y < len(b) and y < len(a):
                if a[y-1] == b[y]:
                    b = b[:y-1] + b[y:]
                    break
                elif a[y] == b[y-1]:
                    a = a[:y-1] + a[y:]
                    break
                y += 1
        else:
            while y < len(b) and y < len(a):
                if a[y-1] == b[y]:
                    b = b[:y-1] + b[y:]
                    break
                elif a[y] == b[y-1]:
                    a = a[:y-1] + a[y:]
                    break
                y += 1
    total = 0
    for z in range(len(b)):
        if z >= len(a):
            total += len(b) - len(a)
            break
        total += ord(a[z]) - ord(b[z])
    if len(a) > len(b):
        total += len(a) - len(b)
    print(total)