183 162 162159
Assuming the file is in
import Data.Char import Data.List d=drop 1 main=readFile"file.txt">>=putStr.concat.dtail.map(dtail.maximum).transpose.map(group.sort.(++' ':['a'..'z'])).lines.map toLower
If file.txt contains, for example
abcde abcdef aaf
The script will output
Basically I'm appending the whole alphabet to each line, so that when grouping and sorting, I'm sure I'll end up with a list that contains 27 elements. Next, I transpose the "frequency table", so that each row in this array consists of the frequencies of a single letter in each line, e.g.
["a","","aaa","aa","aaaa"]. I then choose the maximum of each array (which works just like I want because of how the
Ord-instance of Strings work), and drop the letter that I appended at the start, get rid of the spaces, and output the result.