func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 10;   const int inf = 2000000000;   int f(int first, int second, int t[N]) {     int a[N], b[N];     for (int i = 0; i < N; i++) {       a[i] = b[i] = t[i];     }     a[first]--;     b[second]--;     if (a[first] < 0 || b[second] < 0) {       return -1;     }     if ((first + second) != 10) {       return 0;     }     int cur = 1;     for (int i = 0; i < N; i++) {       cur += min(a[i], b[N - i - 1]);     }     return cur;   }   pair<string, string> get(int a[N], pair<pair<int, int>, int> code) {     int q[N], w[N];     for (int i = 0; i < N; i++) {       q[i] = w[i] = a[i];     }     string s, t;     for (int i = 0; i < code.second; i++) {       s +=  0 ;       t +=  0 ;       q[0]--;       w[0]--;     }     int first = code.first.first;     int second = code.first.second;     s += char(first +  0 );     t += char(second +  0 );     q[first]--;     w[second]--;     for (int i = 0; i < N; i++) {       int val = min(q[i], w[N - i - 1]);       for (int j = 0; j < val; j++) {         s += char(i +  0 );         t += char(N - i - 1 +  0 );       }       q[i] -= val;       w[N - i - 1] -= val;     }     for (int i = 0; i < N; i++) {       for (int j = 0; j < q[i]; j++) {         s += char(i +  0 );       }       for (int j = 0; j < w[i]; j++) {         t += char(i +  0 );       }     }     reverse((s).begin(), (s).end());     reverse((t).begin(), (t).end());     return {s, t};   }   int main() {     cin.tie(0);     ios_base::sync_with_stdio(0);     string s;     cin >> s;     int a[N];     memset(a, 0, sizeof(a));     int n = s.length();     for (int i = 0; i < n; i++) {       a[s[i] -  0 ]++;     }     int best = -1;     pair<pair<int, int>, int> code;     for (int i = 0; i <= a[0]; i++) {       int b[N];       for (int j = 0; j < N; j++) {         b[j] = a[j];       }       b[0] -= i;       for (int first = 0; first < N; first++) {         for (int second = 0; second < N; second++) {           int cur = f(first, second, b);           if (cur + i > best) {             best = cur + i;             code = {{first, second}, i};           }         }       }     }     pair<string, string> ans = get(a, code);     cout << ans.first <<   n  << ans.second;   }   