#include <iostream> #include<algorithm> using namespace std; int work(string& s,string& t) { int i=0; std::sort(t.begin(),t.end(),std::greater<char>()); for(auto& ch : s) { if(ch<t[i]) { ch=t[i]; i++; } } return 0; } int main() { string a, b; while (cin >> a >> b) { // 注意 while 处理多个 case work(a,b); cout << a << endl; } } // 64 位输出请用 printf("%lld")