func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename item>   item abs(item i) {     if (i < 0) i = -i;     return i;   }   char *s;   int n;   int pos;   int main() {     cin >> n;     cin >> pos;     s = new char[n + 2];     cin >> s + 1;     int cnt = 0;     if (n == 1) {       cout << 0;       return 0;     }     if (n % 2 == 1 and pos == n / 2 + 1) pos++, cnt++;     if (pos > n / 2) pos = n - pos + 1;     int last = n / 2, fst = 1;     while (fst < n - fst + 1 and s[fst] == s[n - fst + 1]) fst++;     while (last > 0 and s[last] == s[n + 1 - last]) last--;     if (pos >= fst and pos <= last) {       int a = pos - fst, b = last - pos;       cnt += 2 * (min(a, b)) + max(a, b);     } else if (pos >= fst and pos >= last)       cnt += pos - min(fst, last);     else if (pos <= last and pos <= fst)       cnt += max(fst, last) - pos;     for (int i = 1; i <= n / 2; i++) {       int cmp = n - i + 1;       if (s[i] > s[cmp]) swap(s[i], s[cmp]);       int a = abs((int)(s[i] - s[cmp])), b =  z  - s[cmp] + s[i] -  a  + 1;       cnt += min(a, b);     }     cout << cnt;   }   