fork download
  1. def g(s,c):x=s.split('|');print' #\n'.join(' '*len(''.join(x[:i]))+v+' '*len(''.join(x[i+1:]))for i,v in enumerate(x))+' '+c
  2.  
  3. for s, c in (("a|b|c|d|e|f|g", ","),("abcdefg", ":"),("4|8|15|16|23|42", "%"),("E|ac|h s|ecti|on is| one c|haracte|r longer| than the| last!", "!"),("This|Code|has||empty||sections", "@")):
  4. print'Input:\n',(s,c),'\n\nOutput:'
  5. g(s,c)
  6. print''
Success #stdin #stdout 0s 9024KB
stdin
Standard input is empty
stdout
Input:
('a|b|c|d|e|f|g', ',') 

Output:
a       #
 b      #
  c     #
   d    #
    e   #
     f  #
      g ,

Input:
('abcdefg', ':') 

Output:
abcdefg :

Input:
('4|8|15|16|23|42', '%') 

Output:
4          #
 8         #
  15       #
    16     #
      23   #
        42 %

Input:
('E|ac|h s|ecti|on is| one c|haracte|r longer| than the| last!', '!') 

Output:
E                                                   #
 ac                                                 #
   h s                                              #
      ecti                                          #
          on is                                     #
                one c                               #
                     haracte                        #
                            r longer                #
                                     than the       #
                                              last! !

Input:
('This|Code|has||empty||sections', '@') 

Output:
This                     #
    Code                 #
        has              #
                         #
           empty         #
                         #
                sections @