题解 | #字符串合并处理#
字符串合并处理
https://www.nowcoder.com/practice/d3d8e23870584782b3dd48f26cb39c8f
s1,s2 = input().split()
s = s1+s2
l = list(s)
odd = []
even = []
for i in range(0,len(l),2):
odd.append(l[i])
for i in range(1,len(l),2):
even.append(l[i])
odd.sort()
even.sort()
a = 0
for i in range(0,len(l),2):
l[i] = odd[a]
a += 1
b = 0
for i in range(1,len(l),2):
l[i] = even[b]
b += 1
for i in range(len(l)):
if '0'<=l[i]<='9' or 'a'<=l[i].lower()<='f':
bi = bin(int(l[i],16))[2:].zfill(4)[::-1]
he = hex(int(bi,2))[2].upper()
l[i] = he
print(''.join(l))