•输入一个字符串,请按长度为8拆分每个输入字符串并进行输出;
•长度不是8整数倍的字符串请在后面补数字0,空字符串不处理。
示例:
输入:abc
输出:abc00000
public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNextLine()){ String ss = sc.nextLine(); while (ss.length()>8){ String s1 = ss.substring(0,8); System.out.println(s1); ss = ss.substring(8); } while (ss.length()<8&&ss.length()>0){ ss += "0"; } System.out.println(ss); } }