题解 | #字符串分隔#
字符串分隔
http://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
let str; while(str = readline()){ getStr(str) } function getStr(str){ let resStr; if(str.length == 8){ resStr = str; console.log(resStr) }else if(str.length < 8){ resStr = str.padEnd(8,'0'); console.log(resStr) }else{ let restStr = str.slice(8); resStr = str.slice(0,8); console.log(resStr) getStr(restStr); } }