题解 | #字符串分隔#

字符串分隔

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

const readline = require('readline');

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
rl.on('line', function (line) {
    while(line.length) {
        let str = line.slice(0, 8);
        const bu = 8 - str.length;
        if(bu > 0) {
          for(let i = 0; i < bu; i++) {
            str += "0"
          }
        }
        line = line.slice(8)
        console.log(str)
    }
});

全部评论

相关推荐

点赞 评论 收藏
转发
点赞 收藏 评论
分享
牛客网
牛客企业服务