题解 | #字符串分隔#
字符串分隔
https://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;
void async function () {
// Write your code here
while(line = await readline()){
// 先完整补全0
const newStr = line.padEnd(Math.ceil(line.length / 8) * 8 , 0)
// 用slice取间隔为8的值
for(let i=0;i<newStr.length; i+=8) {
console.log(newStr.slice(i, i+8))
}
}
}()
360集团公司氛围 358人发布
查看9道真题和解析