题解 | #字符串分隔#

字符串分隔

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

def str_split():
    s = ""
    try:
        while True:
            input_str = input().strip()
            if not input_str:
                break
            if len(input_str) % 8 != 0:
                input_str += ((8 - len(input_str) % 8)) * "0"
            s += input_str
    except:
        pass
    for i in range(0, len(s) // 8):
        if i == 0:
            print(s[0: 8])
        else:
            print(s[i * 8: (i + 1) * 8])


str_split()
全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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