func_code_string: #include <bits/stdc++.h>   const int inf = 1e5 + 10;   using namespace std;   int main() {     int to[5][5];     int a[5];     memset(a, 0, sizeof(a));     memset(to, 0, sizeof(to));     ios::sync_with_stdio(0);     int n;     cin >> n;     string s;     cin >> s;     for (int i = 0; i < n; i++) {       if (s[i] ==  0 )         a[0]++;       else if (s[i] ==  1 )         a[1]++;       else if (s[i] ==  2 )         a[2]++;     }     n /= 3;     for (int i = 1; i <= 2; i++) {       for (int j = 0; j < i; j++) {         if (a[j] < a[i] && a[i] > n && a[j] < n) {           to[i][j] = min(n - a[j], a[i] - n);           int p = a[i];           int q = a[j];           a[i] -= min(n - q, p - n);           a[j] += min(n - q, p - n);         } else if (a[j] > a[i] && a[i] < n && a[j] > n) {           int p = a[i];           int q = a[j];           to[j][i] = min(n - p, q - n);           a[j] -= min(n - p, q - n);           a[i] += min(n - p, q - n);         }       }     }     for (int i = 0; i < 2; i++) {       for (int j = 2; j > i; j--) {         int v = 3 * n - 1;         while (to[i][j] && v >= 0) {           if (s[v] -  0  == i) {             s[v] =  0  + j;             to[i][j]--;           }           v--;         }       }     }     for (int i = 1; i <= 2; i++) {       for (int j = 0; j < i; j++) {         int v = 0;         while (to[i][j] && v < 3 * n) {           if (s[v] -  0  == i) {             s[v] =  0  + j;             to[i][j]--;           }           v++;         }       }     }     cout << s << endl;   }   