题解 | #字符串分隔#
字符串分隔
http://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
StringBuffer sb = new StringBuffer(scan.nextLine());
while (sb.length() % 8 != 0) {
sb.append(0);
}
int start = 0;
for (int splitIndex = 8; splitIndex <= sb.length(); splitIndex += 8) {
System.out.println(sb.substring(start, splitIndex));
start = splitIndex;
}
}
}