package zh.codegym.task.task07.task0727; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; /* 更改功能 */ public class Solution { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); ArrayList<String> list = new ArrayList<String>(); while (true) { String s = reader.readLine(); if (s==null) { break; }else{ list.add(s); } } ArrayList<String> listUpperCase = new ArrayList<String>(); for (int i = 0; i < list.size(); i++) { String s = list.get(i); listUpperCase.add(s); } for (int i = 0; i < listUpperCase.size(); ) { if(listUpperCase.get(i).length()%2==0){ listUpperCase.add(i,listUpperCase.get(i)); i+=2; }else if(listUpperCase.get(i).length()%2!=0){ listUpperCase.add(i,listUpperCase.get(i)); listUpperCase.add(i,listUpperCase.get(i)); i+=3; } } for(int i=0;i<listUpperCase.size();){ if(listUpperCase.get(i).length()%2==0){ System.out.println(listUpperCase.get(i) + " " + listUpperCase.get(i+1)); i+=2; }else if(listUpperCase.get(i).length()%2!=0){ System.out.println(listUpperCase.get(i) + " " + listUpperCase.get(i+1) + " " + listUpperCase.get(i+2)); i+=3; } } } }