题解 | #字符串分隔#

字符串分隔

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

const readline = require('readline');

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
const array = []
rl.on('line', function (line) {
    array.push(line)
});
rl.on('close', ()=>{
    array.forEach((item: string) => {
       while(item.length>8){
           console.log(item.substr(0,8))
           item = item.substr(8)
       }
       let n = item.length
       for(let i =0;i<8-n;i++){
           item = item.concat('0')
       }
        console.log(item)
    })
})
全部评论

相关推荐

SHC2:春招先狠狠投递,然后你看看能不能申请香港新加坡的一年制master,花不了多少钱,或者现在赶紧去刷一段实习。HR专业考研没必要
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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