#include using namespace std; #define FOR(a, b, c) for(int a = (b); a < (c); a++) #define SZ(a) (int)((a).size()) #define SIZE(a) (int)((a).size()) #define ALL(a) (a).begin(), (a).end() using ll = long long; #define LL long long #define PB push_back using pch = pair; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s, t; cin >> s >> t; int res = 0; map M; int n = SZ(s); FOR(i, 0, n) { if(s[i] != t[i]) { M[{s[i], t[i]}]++; } } string wsz = "ACGT"; FOR(i, 0, 4) { FOR(j, i + 1, 4) { pch x = {wsz[i], wsz[j]}; pch y = {wsz[j], wsz[i]}; int r = min(M[x], M[y]); M[x] -= r; M[y] -= r; res += r; } } for(auto dl : {3, 4}) { sort(ALL(wsz)); do { int r = 1e9; FOR(i, 0, dl - 1) { r = min(r, M[{wsz[i], wsz[i + 1]}]); } r = min(r, M[{wsz[dl - 1], wsz[0]}]); FOR(i, 0, dl - 1) { M[{wsz[i], wsz[i + 1]}] -= r; } M[{wsz[dl - 1], wsz[0]}] -= r; res += r * (dl - 1); } while(next_permutation(ALL(wsz))); } cout << res << "\n"; }