题解 | #字符串分隔#

字符串分隔

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

const rl = require("readline").createInterface({input:process.stdin});
const iter = rl[Symbol.asyncIterator]();
const readline = async ()=>(await iter.next()).value;

void async function(){
    const str = await readline();
    let res = "";
    for(const c of str){
        if(res.length === 8){
            console.log(res);
            res = "";
        }
        res+=c;        
    }
    if(res.length){
        while(res.length<8) res+="0";
        console.log(res);
    }
}()

全部评论

相关推荐

05-09 12:10
济宁学院 Java
程序员小白条:丰富下简历,有点少了,中小厂反正看运气海投
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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