str1 = input() str2 = input() import collections import itertools pairs = collections.Counter() for i in range(len(str1)): pairs[str1[i] + str2[i]] += 1 switches = 0 test2 = [c+d for c in "ACGT" for d in "ACGT" if c != d] test3 = [x[:-1] for x in itertools.permutations("ACGT")] test4 = list(itertools.permutations("ACGT")) test = test2 + test3 + test4 for t in test: m = min(pairs[t[i] + t[(i+1)%len(t)]] for i in range(len(t))) switches += m * (len(t)-1) for i in range(len(t)): pairs[t[i] + t[(i+1)%len(t)]] -= m print(switches)