func_code_string: #include <bits/stdc++.h>   using namespace std;   long long modInverse(long long a, long long m) {     long long m0 = m;     long long y = 0, x = 1;     if (m == 1) return 0;     while (a > 1) {       long long q = a / m;       long long t = m;       m = a % m, a = t;       t = y;       y = x - q * y;       x = t;     }     if (x < 0) x += m0;     return x;   }   long long nCmmod(long long n, long long m, long long mod) {     vector<long long> a(200001, 1);     for (__typeof(1) i = 1; i < 200001; i += 1) {       a[i] = (a[i - 1] * i) % mod;     }     long long p = 1;     p = (p * a[n]) % mod;     p = (p * modInverse(a[m], mod)) % mod;     p = (p * modInverse(a[n - m], mod)) % mod;     return p;   }   vector<long long> p(long long n) {     long long x = 0;     vector<long long> v;     for (long long i = 1; i <= sqrt(n); i++) {       if (n % i == 0) {         if (n / i == i) {           v.push_back(i);         } else {           v.push_back(i);           v.push_back(n / i);         }       }     }     sort(v.begin(), v.end());     return v;   }   long long bsearch(vector<long long> arr, long long l, long long r, int x) {     if (r >= l) {       long long mid = l + (r - l) / 2;       if (arr[mid] == x) return mid;       if (arr[mid] > x) return bsearch(arr, l, mid - 1, x);       return bsearch(arr, mid + 1, r, x);     }     return l + (r - l) / 2;   }   string decToBinary(long long n) {     string s =   ;     long long f = 0;     for (int i = 31; i >= 0; i--) {       int k = n >> i;       if (k & 1)         s +=  1 ;       else         s +=  0 ;     }     return s;   }   long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }   long long int power(long long int x, long long int y) {     long long int temp;     if (y == 0) return 1;     temp = power(x, y / 2);     if (y % 2 == 0)       return (temp % 1000000007 * temp % 1000000007) % 1000000007;     else {       if (y > 0)         return (x % 1000000007 * temp % 1000000007 * temp % 1000000007) %                1000000007;       else         return (temp % 1000000007 * temp % 1000000007) % 1000000007 / x;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long t = 1;     cin >> t;     while (t--) {       long long n, k;       cin >> n >> k;       string s;       cin >> s;       long long m = n / k;       long long cn = (k + 1) / 2;       long long r = 0;       for (__typeof(cn) i = 0; i < cn; i += 1) {         vector<long long> A(26, 0);         char c = s[i];         for (__typeof(m) j = 0; j < m; j += 1) {           A[s[j * k + i] -  a ] += 1;         }         for (__typeof(m) j = 0; j < m; j += 1) {           A[s[j * k + k - 1 - i] -  a ] += 1;         }         long long ma = -1;         for (__typeof(26) j = 0; j < 26; j += 1) {           if (A[j] > ma) {             ma = A[j];           }         }         if (k % 2 == 1 && i == cn - 1)           r += m - ma / 2;         else           r += 2 * m - ma;       }       cout << r << endl;     }   }   