func_code_string: #include <bits/stdc++.h>   using namespace std;   int cnt[15];   int s[15];   char c[1 << 20];   int need[15];   int digits(int first) { return !first ? 0 : 1 + digits(first / 10); }   int main(void) {     int n;     string str;     cin >> (c + 1) >> str;     n = strlen(c + 1);     for (auto it : str) ++need[it -  0 ];     for (int i = 1; i <= n; ++i) ++cnt[c[i] -  0 ];     for (int nr = 1; nr < n; ++nr)       if (digits(nr) + nr == n) {         for (int i = 0; i <= 9; ++i) s[i] = cnt[i];         int sum = nr;         while (sum) --s[sum % 10], sum /= 10;         int can = 1;         for (int i = 0; i <= 9; ++i)           if (s[i] < need[i]) can = 0;         int prim = 1;         for (int i = 0; i <= 9; ++i) s[i] -= need[i];         for (; prim <= 9; ++prim)           if (s[prim] || (prim == str[0] -  0  && !s[prim])) break;         if (prim == 10) can = 0;         if (can) {           string ans1 =   , ans2 =   ;           int ct = 0;           while (ct + 1 < str.length() && str[ct] == str[ct + 1]) ++ct;           int after = -1;           if (ct + 1 >= str.length() || str[ct] > str[ct + 1])             after = 0;           else             after = 1;           string str1 = str, str2 = str;           if (prim == str[0] -  0 ) {             ans1 += str1;             str1 =   ;           }           for (int i = 0; i <= 9; ++i) cnt[i] -= need[i];           ans2 += prim +  0 ;           int sum = nr;           while (sum) --cnt[sum % 10], sum /= 10;           --cnt[prim];           for (int i = 0; i <= 9; ++i)             while (s[i] > 0) --s[i], ans1 += i +  0 ;           for (int i = 0; i <= 9; ++i) {             if (!str2.empty()) {               if (after && i > str2[0] -  0 )                 ans2 += str2, str2 =   ;               else if (!after && i >= str2[0] -  0 )                 ans2 += str2, str2 =   ;             }             while (cnt[i] > 0) --cnt[i], ans2 += i +  0 ;           }           for (int i = 0; i <= 9; ++i)             if (cnt[i] < 0) ans2 =   ;           if (ans1.length() == ans2.length())             cout << min(ans1, ans2) <<   n ;           else {             if (ans2 ==   )               cout << ans1 <<   n ;             else               cout << ans2 <<   n ;           }           return 0;         }       }     assert(cnt[0] == 1 && cnt[1] == 1 && n == 2);     cout <<  0 n ;     return 0;   }   