#include <iostream> #include <algorithm> using namespace std; string join(string s1,string s2){ //第一步,合并 string s; s = s1 + s2; string s_sort1,s_sort2; //第二步:对合并后的字符串的两个数组进行排序,再合并 for (int i = 0; i < s.size(); i += 2){ s_sort1 += s[i]; } for (int i = 1; i < s.size(); i += 2){ s_sort2 += s[i]; } sort(s_sort1.begin(),s_sort1.end()); sort(s_sort2.begin(),s_sort2.end()); int j = 0, k = 0; for (int i = 0; i < s.size(); ++i){ if (i % 2 == 0) s[i] = s_sort1[j++]; else s[i] = s_sort2[k++]; } // 第三步:利用字典法一一映射,题目说了转换为大写字母 string A = "0123456789abcdefABCDEF"; string B = "084C2A6E195D3B7F5D3B7F"; for (char &c:s){ if (c >= '0' && c <= '9'){ c = B[c - '0']; } else if (c >= 'a' && c <= 'f'){ c = B[c - 'a' + 10]; } else if (c >= 'A' && c <= 'F'){ c = B[c - 'A' + 16]; } } return s; } int main() { string s1, s2; string res; while (cin >> s1 >> s2) { res = join(s1,s2); cout << res << endl; } return 0; }