字符串分割
字符串分隔
http://www.nowcoder.com/questionTerminal/d9162298cb5a437aad722fccccaae8a7
import java.io.*; import java.util.*; public class Main{ public static void main(String[] args) throws Exception{ Scanner sc = new Scanner(System.in); while(sc.hasNextLine()){ String s = sc.nextLine(); if(s.length() <= 8){ System.out.print(s); for(int i = 1; i <= 8 - s.length(); ++i){ System.out.print("0"); } System.out.println(); }else{ int start = 0; while((start <= s.length() - 1) && (start + 7 <= s.length() - 1)){ System.out.println(s.substring(start, start + 8)); start += 8; } if(start != s.length()){ System.out.print(s.substring(start, s.length())); for(int i = 1; i <= 8 - (s.length() - start); ++i){ System.out.print("0"); } System.out.println(); } } } } }