题解 | 字符串合并处理

字符串合并处理

https://www.nowcoder.com/practice/d3d8e23870584782b3dd48f26cb39c8f

a = input().split()
a =  list(a[0] + a[1])
a[::2] = sorted(a[::2])  
a[1::2] = sorted(a[1::2]) 
for i in a:
    if i.isdigit() or (i.isalpha() and i.upper()<'G'):
        print(hex(int( ''.join(reversed(bin(int(i.lower(),16) )[2:].rjust(4,"0"))) ,2))[2:].upper(),end='')
    else:
        print(i,end='')

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务