Title Description
• Continuous input string, after splitting each string by a length of 8, output to a new string array;
• Strings that are not 8 integer times are appended to the number 0, and the empty string is not processed.
Input Description: Continuous input string (input 2 times, each string length less than 100)
Output Description: Output to a new string array of length 8
Input Example:
Abc
123456789
Output Example:
abc00000
12345678
90000000
ImportJava.util.Scanner; Public classSplit812 { Public Static voidMain (string[] args) {Scanner Scanner=NewScanner (system.in); while(Scanner.hasnext ()) {string string=Scanner.nextline (); Split (string); } } Private Static voidSplit (String string) { while(String.Length () >= 8) {System.out.println (string.substring (0,8)); String= String.substring (8); } if(String.Length () > 0 && string.length () < 8) {string+ = "00000000"; System.out.println (String.substring (0,8)); } }}
12: Split string per 8 bits