func_code_string: #include <bits/stdc++.h>   using namespace std;   int freq[3];   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     int n;     cin >> n;     string s;     cin >> s;     for (int i = 0; i < n; i++) {       freq[s[i] -  0 ]++;     }     for (int i = n - 1; i >= 0; i--) {       if (freq[0] <= n / 3) {         break;       }       if (s[i] ==  0 ) {         if (freq[2] < n / 3) {           freq[2]++;           s[i] =  2 ;           freq[0]--;         } else {           freq[1]++;           s[i] =  1 ;           freq[0]--;         }       }     }     for (int i = 0; i < n; i++) {       if (freq[1] <= n / 3) break;       if (s[i] ==  1 ) {         if (freq[0] < n / 3) {           freq[0]++;           freq[1]--;           s[i] =  0 ;         }       }     }     for (int i = n - 1; i >= 0; i--) {       if (freq[1] <= n / 3) break;       if (s[i] ==  1 ) {         if (freq[2] < n / 3) {           freq[2]++;           freq[1]--;           s[i] =  2 ;         }       }     }     for (int i = 0; i < n; i++) {       if (freq[2] <= n / 3) break;       if (s[i] ==  2 ) {         if (freq[0] < n / 3) {           freq[0]++;           freq[2]--;           s[i] =  0 ;         } else {           freq[1]++;           freq[2]--;           s[i] =  1 ;         }       }     }     cout << s;     return 0;   }   