from itertools import zip_longest

txt = 

parts = [line.rstrip().split() for line in txt.splitlines()]
widths = [max(len(word) for word in col) 
          for col in zip_longest(*parts, fillvalue='')]

for justify in .split():
    j, jtext = justify.split('_')
    print(f)
    for line in parts:
        print(' '.join(f for wdth, wrd in zip(widths, line)))
    print( * 52)