func_code_string: #include <bits/stdc++.h>   using namespace std;   int lft[26];   char s[111111], t[111111];   int n, m;   int main() {     gets(s);     n = (int)strlen(s);     for (int i = 0; i < n; ++i) lft[s[i] -  a ]++;     gets(t);     m = (int)strlen(t);     for (int i = 0; i < n; ++i) {       bool fnd = 0;       for (int let = 0; let < 26; ++let) {         if (!lft[let]) continue;         s[i] =  a  + let;         lft[let]--;         int pos = i + 1;         for (int j = 25; j >= 0; --j) {           for (int k = 0; k < lft[j]; ++k) s[pos++] =  a  + j;         }         s[n] = 0;         if (strcmp(s, t) == 1) {           fnd = 1;           break;         }         lft[let]++;       }       if (!fnd) {         cout <<  -1 n ;         return 0;       }     }     puts(s);     return 0;   }   