题解 | #字符串分隔#

字符串分隔

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

let input = ''

while(line = await readline()){

input = line;

}

function fn(input){

if(input.length > 8){

console.log(input.slice(0,8));

input = input.slice(8);

fn(input)

}else{

input = input.split('')

console.log(Array.from({length: 8, ...input}, (item)=>{if(item===undefined) return 0; else return item}).join(''))

}

}

fn(input)

}()

全部评论

相关推荐

点赞 评论 收藏
分享
06-04 16:50
腾讯_TEG_技术
点赞 评论 收藏
分享
葬爱~冷少:我当时都是上午刷力扣,下午背八股,有活给我先别急,没活就干自己的事情
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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