题解 | #字符串分隔#
字符串分隔
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())) {
let tLine = line;
let t = 0;
let str = "";
for (let i = 0; i < tLine.length; i++) {
if (t < 8) {
str = str.concat(tLine[i]);
t++;
} else {
console.log(str);
str = tLine[i];
t = 1;
}
if (t < 8 && i === tLine.length - 1) {
for (let j = t; j < 8; j++) {
str = str.concat("0");
}
}
}
console.log(str);
}
})();