题解 | #字符串合并处理#

字符串合并处理

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

while 1:
    try:
        s1, s2 = input().split()
        s = list(s1 + s2)
    except:
        break
    else:
        s[::2]=sorted(s[::2])
        s[1::2]=sorted(s[1::2])
        for i in s:
            try:
                b=bin(int(i,16))[2:]
                b='0'*(4-len(b))+b if len(b)<4 else b
                b=b[::-1]
                b=hex(int(b,2))[2:].upper()
                print(b,end='')
            except:
                print(i,end='')
         
全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务