- import java.util.*;
- import static java.lang.System.*;
- public class main{
- public static void main(String[] args) {
- Scanner sc=new Scanner(System.in);
- int max = 0;
- List inputs = new ArrayList();
- while(sc.hasNextLine())
- {
- String str = sc.nextLine();
- if(str.length() > max)
- max = str.length();
- inputs.add(str);
- }
- Collections.reverse(inputs);
- for(int j = 0; j < max; j++)
- {
- int count = 0;
- for(int i = 0; i < inputs.size(); i++)
- {
- String str = inputs.get(i);
- if(j < str.length())
- {
- while(count > 0)
- {
- System.out.print(" ");
- count--;
- }
- System.out.print(str.charAt(j));
- count = 0;
- }
- else
- count++;
- }
- System.out.println();
- }
- }
- };
留言
張貼留言