题解 | #字符串分隔#
字符串分隔
https://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
直接按题意写算法,满八个添加到答案列表,剩余的填补0加入答案列表,最后答案列表输出
#华为笔试#
temp = input()
n = len(temp) // 8
ans = list()
res = str("")
for i in range(8*n):
res += temp[i]
if (i + 1) % 8 == 0:
ans.append(res)
res = str("")
temp = temp[8*n:]
while 0 <len(temp) < 8:
temp += "0"
ans.append(temp)
for an in ans:
print(an)
#华为笔试#
