题解 | #字符串分隔#
字符串分隔
http://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
var str
while(str = readline()) {
if (str.length <= 8) {
calc(str);
} else {
var count = 0
while(true) {
var tempStr = str.substr(count * 8, 8);
if (!tempStr) break;
calc(tempStr);
count++;
}
}
}
function calc(str) {
if (str.length === 8) {
console.log(str);
} else if (str.length < 8) {
console.log(str + (new Array(8 - str.length)).fill(0).join(''));
}
}