func_code_string: #include <bits/stdc++.h>   using namespace std;   string s, t;   int arr1[2222], arr2[2222];   char ans[999999];   long long int i, j, lo, hi, mid, cnt, sum, nd;   queue<int> q;   int main() {     cin >> s >> t;     for (i = 0; i < t.size(); i++) {       arr2[(int)(t[i] -  a )]++;     }     cnt = 0;     for (i = 0; i < s.size(); i++) {       if (s[i] ==  ? ) {         cnt++;         q.push(i);       } else         arr1[(int)(s[i] -  a )]++;     }     lo = 0;     hi = 10000000;     while (lo <= hi) {       mid = (lo + hi) / 2;       sum = 0;       for (i = 0; i < 26; i++) {         nd = arr2[i] * mid;         nd -= arr1[i];         if (nd < 0) nd = 0;         sum = sum + nd;       }       if (sum >= cnt)         hi = mid - 1;       else         lo = mid + 1;     }     mid++;     sum = 0;     for (i = 0; i < 26; i++) {       nd = arr2[i] * mid;       nd -= arr1[i];       if (nd < 0) nd = 0;       sum = sum + nd;     }     if (sum > cnt) {       mid--;       sum = 0;       for (i = 0; i < 26; i++) {         nd = arr2[i] * mid;         nd -= arr1[i];         if (nd < 0) nd = 0;         sum = sum + nd;       }       if (sum > cnt) mid--;     }     for (i = 0; i < 26; i++) {       arr2[i] = arr2[i] * mid;       if (arr2[i]) {         while (arr2[i]--) {           if (arr1[i])             arr1[i]--;           else {             int u = q.front();             q.pop();             s[u] = (char)i +  a ;             cnt--;           }         }       }     }     while (cnt--) {       int u = q.front();       q.pop();       s[u] =  z ;     }     cout << s << endl;     return 0;   }   