import sys


def parse_rucksack(line):
    line = line.strip()

    a = set(line[: len(line) // 2])
    b = set(line[len(line) // 2 :])

    return a, b


def get_priority(item):
    if item.islower():
        return ord(item) - ord("a") + 1
    elif item.isupper():
        return ord(item) - ord("A") + 27
    else:
        assert False


def main():
    rucksacks = [parse_rucksack(line) for line in sys.stdin]
    print(sum(get_priority(item) for a, b in rucksacks for item in a & b))


if __name__ == "__main__":
    main()
