•連續輸入字符串,請按長度為8拆分每個字符串后輸出到新的字符串數組;
•長度不是8整數倍的字符串請在后面補數字0,空字符串不處理。
輸入描述:
連續輸入字符串(輸入2次,每個字符串長度小於100)
輸出描述:
輸出到長度為8的新字符串數組
輸入例子:
abc 123456789
輸出例子:
abc00000 12345678 90000000
import
java.util.*;
public
class
Main{
public
static
void
main(String[] args){
Scanner sc =
new
Scanner(System.in);
while
(sc.hasNext()){
String s =
new
String(sc.nextLine());
if
(s.length()%
8
!=
0
)
s = s +
"00000000"
;
while
(s.length()>=
8
){
System.out.println(s.substring(
0
,
8
));
s = s.substring(
8
);
}
}
}
}
