func_code_string: #include <bits/stdc++.h>   using namespace std;   int generateb(int a, long int nos[], long int noa[], long int nob[]) {     int i, minb = 100002;     for (i = 0; i < 26; i++) {       nos[i] = nos[i] - (noa[i] * a);     }     for (i = 0; i < 26; i++) {       if (nob[i] != 0) {         if (nos[i] / nob[i] < minb) {           minb = nos[i] / nob[i];         }       }     }     return minb;   }   int generatea(int b, long int nos[], long int noa[], long int nob[]) {     int i, mina = 100002;     for (i = 0; i < 26; i++) {       nos[i] = nos[i] - (nob[i] * b);     }     for (i = 0; i < 26; i++) {       if (noa[i] != 0) {         if (nos[i] / noa[i] < mina) {           mina = nos[i] / noa[i];         }       }     }     return mina;   }   int main() {     char s[100010], a[100010], b[100010];     long int nos[26] = {0}, i, lens = 0, noa[26] = {0}, nob[26] = {0}, lena = 0,              lenb = 0, j, nos1[26] = {0}, mina = 100002, counta, countb, max = -1,              maxa, maxb, minb = 100002, r;     cin >> s >> a >> b;     for (i = 0; s[i] !=   0 ; i++) {       nos[s[i] -  a ]++;       lens++;     }     for (j = 0; j < 26; j++) {       nos1[j] = nos[j];     }     for (i = 0; a[i] !=   0 ; i++) {       noa[a[i] -  a ]++;       lena++;     }     for (i = 0; b[i] !=   0 ; i++) {       nob[b[i] -  a ]++;       lenb++;     }     for (i = 0; i < 26; i++) {       if (noa[i] != 0) {         if (nos[i] / noa[i] < mina) {           mina = nos[i] / noa[i];         }       }     }     for (i = 0; i <= mina; i++) {       countb = generateb(i, nos, noa, nob);       for (j = 0; j < 26; j++) {         nos[j] = nos1[j];       }       if (i + countb > max) {         max = i + countb;         maxa = i;         maxb = countb;       }     }     for (i = 0; i < 26; i++) {       if (nob[i] != 0) {         if (nos[i] / nob[i] < minb) {           minb = nos[i] / nob[i];         }       }     }     for (i = 0; i <= minb; i++) {       counta = generatea(i, nos, noa, nob);       for (j = 0; j < 26; j++) {         nos[j] = nos1[j];       }       if (i + counta > max) {         max = i + counta;         maxb = i;         maxa = counta;       }     }     for (i = 0; i < maxa; i++) {       cout << a;     }     for (i = 0; i < maxb; i++) {       cout << b;     }     for (i = 0; i < 26; i++) {       nos[i] = nos[i] - (maxa * noa[i]) - (maxb * nob[i]);     }     for (i = 0; i < 26; i++) {       for (j = 0; j < nos[i]; j++) {         cout << char(i +  a );       }     }     return 0;   }   