fork download
  1. import sys
  2. text = """package main
  3.  
  4. import "fmt"
  5.  
  6. func main() {
  7. queue := make(chan string, 2)
  8. queue <- "one"
  9. queue <- "twoO"
  10. close(queue)
  11. for elem := range queue {
  12. fmt.Println(elem)
  13. }
  14. }"""
  15. lines = text.split("\n")
  16. max_chars = 0
  17. for line in lines:
  18. if len(line) > max_chars:
  19. max_chars = len(line)
  20.  
  21. for i, val in enumerate(lines):
  22. lines[i] = val + ' ' * (max_chars-len(val))
  23.  
  24. for i in range(0, max_chars):
  25. space_cnt = 0
  26. for line in lines:
  27. if line[i] != ' ':
  28. if space_cnt:
  29. sys.stdout.write(' ' * space_cnt)
  30. space_cnt = 0
  31. sys.stdout.write(line[i])
  32. else:
  33. space_cnt += 1
  34. sys.stdout.write("\n")
Success #stdin #stdout 0.02s 9944KB
stdin
Standard input is empty
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
     )