fork(2) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. LinkedList<String> lines = new LinkedList<String>();
  13. Scanner in = new Scanner(System.in);
  14. int max = 0;
  15. while(in.hasNext()) {
  16. String line = in.nextLine().replaceAll("\\s+$", "");
  17. if(line.length() > max) {
  18. max = line.length();
  19. }
  20. lines.add(line);
  21. }
  22. for(int i=0; i<max;i++) {
  23. String transposed = "";
  24. for(String line : lines) {
  25. transposed+=(i<line.length() ? line.charAt(i) : ' ');
  26. }
  27. System.out.println(transposed.replaceAll("\\s+$", ""));
  28. }
  29. }
  30. }
Success #stdin #stdout 0.17s 321344KB
stdin
package main

import "fmt"

func main() {
    queue := make(chan string, 2)
    queue <- "one"
    queue <- "twoO"
    close(queue)
    for elem := range queue {
        fmt.Println(elem)
    }
}
stdout
p i f       }
a m u
c p n
k o c
a r  qqqcf }
g t muuulo
e   aeeeor
  " iuuus
m f neeeeef
a m (   (lm
i t ):<<qet
n "  =--um.
    {   e P
     m""u:r
     aote=i
     knw) n
     eeo rt
     ("O al
     c " nn
     h   g(
     a   ee
     n    l
         qe
     s   um
     t   e)
     r   u
     i   e
     n
     g   {
     ,

     2
     )