global width inp$[] . proc read . repeat inp$ = input until inp$ = "" inp$[] &= inp$ ar$[] = strsplit inp$ "$" for s$ in ar$[] width = higher width len s$ . . . read # proc out mode . for inp$ in inp$[] ar$[] = strsplit inp$ "$" for s$ in ar$[] spc = width - len s$ + 1 if mode = 1 write s$ for i to spc write " " . elif mode = 2 for i to spc write " " . write s$ elif mode = 3 for i to spc div 2 write " " . write s$ for i to spc - spc div 2 write " " . . . print "" . . out 1 print "" out 2 print "" out 3 # input_data Given$a$text$file$of$many$lines,$where$fields$within$a$line$ are$delineated$by$a$single$'dollar'$character,$write$a$program that$aligns$each$column$of$fields$by$ensuring$that$words$in$each$ column$are$separated$by$at$least$one$space. Further,$allow$for$each$word$in$a$column$to$be$either$left$ justified,$right$justified,$or$center$justified$within$its$column.