func_code_string: #include <bits/stdc++.h>   using namespace std;   inline long long in() {     long long x = 0;     int n = 1;     char c = getchar();     while (!isdigit(c)) {       n = (c ==  - ) ? -1 : 1;       c = getchar();     }     while (isdigit(c)) {       x = x * 10 + c -  0 ;       c = getchar();     }     return x * n;   }   const int N = 80;   int n, a[N], d[5];   int f[N][N][N][2];   string s;   int NOR(int x) {     if (x < 0) return -x;     return 0;   }   void UPD(int &a, int b) {     if (a == -1)       a = b;     else       a = min(a, b);   }   int main() {     n = in();     cin >> s;     s =     + s;     for (int i = 1; i <= n; i++) {       a[i] = (s[i] ==  V ) ? 1 : (s[i] ==  K ) ? 2 : 0;       d[a[i]]++;     }     memset(f, -1, sizeof(f));     f[0][0][0][0] = f[0][0][0][1] = 0;     for (int z = 0; z <= d[0]; z++)       for (int v = 0; v <= d[1]; v++)         for (int k = 0; k <= d[2]; k++)           for (int ov = 0; ov <= 1; ov++)             if (f[z][v][k][ov] >= 0) {               for (int nd = 0; nd <= 2; nd++) {                 if (ov == 1 && nd == 2) continue;                 int Z = z + (nd == 0), V = v + (nd == 1), K = k + (nd == 2);                 int d[5];                 d[0] = z, d[1] = v, d[2] = k;                 int left = 0;                 for (int i = 1; i <= n; i++) {                   if (a[i] == nd && d[a[i]] == 0) break;                   if (d[a[i]] == 0)                     left++;                   else                     d[a[i]]--;                 }                 UPD(f[Z][V][K][(nd == 1)], f[z][v][k][ov] + left);               }             }     int res = -1;     for (int ov = 0; ov <= 1; ov++) UPD(res, f[d[0]][d[1]][d[2]][ov]);     if (res == -1)       cout << 0;     else       cout << res;   }   