java解法
字符串分隔
http://www.nowcoder.com/questionTerminal/d9162298cb5a437aad722fccccaae8a7
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); while(sc.hasNext()){ StringBuilder sb = new StringBuilder(); sb.append(sc.nextLine()); dealStr(sb); } } public static void dealStr(StringBuilder str){ int len = str.length(); int n = len / 8; int last = len % 8; int index = 0; for(int i = 0; i < n; i++){ System.out.println(str.substring(index,index+8)); index += 8; } StringBuilder sb1 = new StringBuilder(); sb1.append(str.substring(index)); if(last > 0){ for(int i = 0; i < 8 - last; i++){ sb1.append(0); } } System.out.println(sb1); } }