#include using namespace std; typedef long long ll; typedef double lf; typedef pair pii; typedef pair pll; #define TRACE(x) cerr << #x << ' ' << x << endl #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define _ << ' ' << #define fi first #define sec second #define se second #define mp make_pair #define pb push_back int trans(char c) { if (c == 'A') return 0; if (c == 'C') return 1; if (c == 'G') return 2; if (c == 'T') return 3; return -1; } int cnt[4][4]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; string s, t; cin >> s >> t; n = s.length(); int B = 0; for (int i = 0; i < n; i++) { if (s[i] == t[i]) B++; else cnt[trans(s[i])][trans(t[i])]++; } int A = 0; vector> V; for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) { if (i == j) continue; V.push_back({i, j}); } for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) { if (i == j) continue; for (int k = 0; k < 4; k++) { if (k == i || k == j) continue; V.push_back({i, j, k}); } } for (auto v : V) { vector> q; for (int i = 0; i < (int)v.size(); i++) q.push_back({v[i], v[(i + 1) % (int)v.size()]}); while (true) { bool ok = true; for (auto p : q) ok &= (cnt[p.fi][p.sec] > 0); if (ok) { A++; for (auto p : q) ok &= cnt[p.fi][p.sec]--; } else { break; } } } int C = 0; for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) if (i != j) C += cnt[i][j]; assert(C % 4 == 0); C /= 4; cout << n - A - B - C; return 0; }