#include<bits/stdc++.h>
using namespace std;
string A;
string B;
int n;
map<string, int> s;
vector<vector<int>> cntA(3); // cntA[0] er en prefix sum på antallet af A'er
vector<vector<int>> cntB(3);
vector<vector<int>> cnt(6); // 0: ac, 1: ca, 2: ct, 3: tc, 4: at, 5: ta
void init(string a, string b){
s["A"] = 0;
s["C"] = 1;
s["T"] = 2;
s["AC"] = 0;
s["CA"] = 1;
s["CT"] = 2;
s["TC"] = 3;
s["AT"] = 4;
s["TA"] = 5;
for (auto &p : cntA){
p.push_back(0);
}
for (auto &p : cntB){
p.push_back(0);
}
for (auto &p : cnt){
p.push_back(0);
}
A = a;
B = b;
n = (int)a.size();
for (int i = 0; i < n; i++){
char c_A = A[i];
char c_B = B[i];
for (auto &p : cntA){
p.push_back(p.back());
}
for (auto &p : cntB){
p.push_back(p.back()); // Så den forrige sum
}
for (auto &p : cnt){
p.push_back(p.back());
}
string h = "";
string e = "";
string j = "";
h += c_A;
e += c_B;
j += c_A; j += c_B;
cntA[s[h]].back()++;
cntB[s[e]].back()++;
if (j == "AA" || j == "CC" || j == "TT"){continue;}
cnt[s[j]].back()++;
}
// for (auto &p : cnt){
// for (auto &q : p){
// cout << q << " ";
// }
// cout << "\n";
// }
}
int get_distance(int x, int y){
x++; y++;
for (int i = 0; i < 3; i++){
if (cntA[i][y] - cntA[i][x - 1] != cntB[i][y] - cntB[i][x - 1]){
return -1;
}
}
int ans = 0;
for (int i = 0; i < 6; i += 2){
ans += max(cnt[i][y] - cnt[i][x - 1], cnt[i + 1][y] - cnt[i + 1][x - 1]);
}
return ans;
}
// int main(){
// init("ATACAT", "ACTATA");
// cout << get_distances(1, 3);
// return 0;
// }
// int get_distance()