题解 | #字符串合并处理#
字符串合并处理
https://www.nowcoder.com/practice/d3d8e23870584782b3dd48f26cb39c8f
# 2024年11月5日 周二 上午11:54 # wujie s1, s2 = input().split() s = s1 + s2 s3 = "" s4 = "" for i in range(len(s)): if i % 2 == 0: s3 += s[i] elif i % 2 == 1: s4 += s[i] s5 = sorted(s3) s6 = sorted(s4) # “abcedf” s7 = "" for i in range(len(s)): # print(i,end = ' ') if i % 2 == 0: s7 += s5[i // 2] else: s7 += s6[i // 2] s8 = "" for i in s7: if ( ord("0") <= ord(i) <= ord("9") or ord("A") <= ord(i) <= ord("F") or ord("a") <= ord(i) <= ord("f") ): t = (bin(int(i, 16))[2:].zfill(4))[::-1] # 注意这里的写法 tt = (hex(int(t, 2))[2:]).upper() s8 += tt else: s8 += i print(s8)