题解 | #字符串分隔#

字符串分隔

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)
    })
})
全部评论

相关推荐

不愿透露姓名的神秘牛友
07-08 14:10
点赞 评论 收藏
分享
06-25 16:25
梧州学院 Java
愿汐_:项目介绍那么长,然而你做了啥就一句话?
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
05-29 20:12
点赞 评论 收藏
分享
码农索隆:有点耳熟,你们是我教过最差的一届
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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