#include #define ll long long #define ld long double #define fi first #define se second #define pll pair #define INF (1ll << 60) #define ppl pair #define vl vector #define vi vector #define vvi vector #define vvl vector #define vb vector #define FOR(i,a,b) for(ll i=a;i= g){ return vi(0); } if(!vis[x]){ return vi(1, x); } vis[x] = false; FOR(i, 0, 4){ if(x != i && tab[x][i] > 0){ vi res = dfs(tab, vis, g, i, d+1); if(res.size() > 0){ res.push_back(x); vis[x] = true; return res; } } } vis[x] = true; return vi(0); } ll fix(vvi &tab, vi &v){ ll min_v = INF; ll res = 0; FOR(i, 0, v.size()-1){ int s = v[i+1]; int e = v[i]; min_v = min(min_v, tab[s][e]); } FOR(i, 0, v.size()-1){ int s = v[i+1]; int e = v[i]; tab[s][e] -= min_v; res += min_v; } res -= min_v; return res; } int c_to_int(char c){ switch (c) { case 'C': return 0; case 'G': return 1; case 'A': return 2; case 'T': return 3; default: return -1; } } int main() { ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); string in, out; cin >> in >> out; vb vis(4, true); vvi tab(4, vi(4, 0)); ll res = 0; FOR(i, 0, in.size()){ if(in[i] != out[i]){ int x = c_to_int(in[i]); int y = c_to_int(out[i]); tab[x][y]++; } } FOR(d, 1, 6){ FOR(i, 0, 4){ bool check = true; while(check){ check = false; vi r = dfs(tab, vis, d, i, 0); if(r.size() > 0){ res += fix(tab, r); } } } } cout << res << endl; return 0; }