#include using namespace std; #define LL long long #define LD long double #define PII pair #define VI vector #define VPII vector #define f first #define s second #define MP make_pair #define PB push_back #define endl '\n' #define SIZ(c) (int)(c).size() #define ALL(c) (c).begin(), (c).end() #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define FOR(i, b, e) for (int i = (b); i <= (int)(e); i++) #define FORD(i, b, e) for (int i = (b); i >= (int)(e); i--) #define ll LL #define st f #define nd s #define mp MP #define pb PB #define eb emplace_back #define siz(c) SIZ(c) const int inf = 1e9 + 7; const LL INF = 1e18L + 7; #define sim template ostream & operator << (ostream &p, pair x) {return p << "<" << x.f << ", " << x.s << ">";} sim> auto operator << (ostream &p, n y) -> typename enable_if::value, decltype(y.begin(), p)>::type {int o = 0; p << "{"; for (auto c : y) {if (o++) p << ", "; p << c;} return p << "}";} void dor() {cerr << "\n";} sim, class...s> void dor(n p, s...y) {cerr << p << " "; dor(y...);} sim, class s> void mini(n &p, s y) {if (p > y) p = y;} sim, class s> void maxi(n &p, s y) {if (p < y) p = y;} #ifdef DEB #define debug(...) dor(__FUNCTION__, ":", __LINE__, ": ", __VA_ARGS__) #else #define debug(...) #endif #define I(x) #x " =", (x), " " string s, t; map mapa; int ile[5][5], n; int32_t main() { mapa['A'] = 0; mapa['C'] = 1; mapa['G'] = 2; mapa['T'] = 3; ios_base::sync_with_stdio(0); cin.tie(0); cin >> s >> t; n = SIZ(s); int all = 0, res = 0; FOR(i, 0, n - 1) { if (mapa[s[i]] != mapa[t[i]]) { ile[mapa[s[i]]][mapa[t[i]]]++; all++; } } FOR(i, 0, 3) { FOR(j, i + 1, 3) { int x = min(ile[i][j], ile[j][i]); ile[i][j] -= x; ile[j][i] -= x; res += x; all -= 2 * x; } } VI X{0, 1, 2, 3}; do { int x = min(ile[X[0]][X[1]], min(ile[X[1]][X[2]], ile[X[2]][X[0]])); ile[X[0]][X[1]] -= x; ile[X[1]][X[2]] -= x; ile[X[2]][X[0]] -= x; res += 2 * x; all -= 3 * x; } while (next_permutation(ALL(X))); assert(all % 4 == 0); res += all / 4 * 3; cout << res << "\n"; }