2022 Developer Survey is open! Take survey.
2 of 6
added 2 characters in body
Flonk
  • 7.8k
  • 2
  • 21
  • 25

Haskell, 183

Assuming the file is in file.txt!

import Data.Char
import Data.List
r=group.sort.(++['a'..'z'])
u=dropWhile(==' ').concat.fmap(drop 1.maximum).transpose.fmap r.lines.fmap toLower
main=fmap u(readFile"file.txt")>>=print

If file.txt contains, for example

abcde
abcdef
aaf

The script will output

"aabcdef"
Flonk
  • 7.8k
  • 2
  • 21
  • 25