1 import java.util.Scanner; 2 public class Main{ 3 public static void main(String[] args){ 4 Scanner scan = new Scanner(System.in); 5 scan.useDelimiter(" "); 6 String str = scan.next(); //接受的字符串,可能含有空格 7 char c[] = str.toCharArray(); 8 char c1[] = new char[c.length]; 9 int j=0; 10 for(int i=0;i<c.length;i++){ 11 if(c[i] != ' '){ 12 c1[j] = c[i]; 13 j++; 14 } 15 } 16 String str1 = new String(c1).trim();//得到没有空格的字符串 17 if(str1.length()<=6){ 18 System.out.println(str1); 19 } 20 if(str1.length()>6 && str1.length()<=14){ 21 String str2 = str1.substring(0, 6); 22 String str3 = str1.substring(6, str1.length()); 23 System.out.println(str2 + " " + str3); 24 } 25 if(str1.length()>14){ 26 String str4 = str1.substring(0, 6); 27 String str5 = str1.substring(6, 14); 28 String str6 = str1.substring(14, str1.length()); 29 System.out.println(str4 + " " + str5 + " " + str6); 30 } 31 } 32 }