deleted 4 characters in body
Flonk
• 7.8k
• 2
• 20
• 25

Assuming the file is in file.txt!

import Data.Char
import Data.List
d=drop 1


If file.txt contains, for example

abcde
abcdef
aaf


The script will output

aabcdef


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.

Flonk
• 7.8k
• 2
• 20
• 25

Assuming the file is in file.txt!

import Data.Char
import Data.List
d=drop 1


If file.txt contains, for example

abcde
abcdef
aaf


The script will output

aabcdef


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 then transpose the "frequency table" (I think of transpose as some sort of generalized zip that zips a list of lists into a list of lists), 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.

Flonk
• 7.8k
• 2
• 20
• 25

Assuming the file is in file.txt!

import Data.Char
import Data.List
d=drop 1


If file.txt contains, for example

abcde
abcdef
aaf


The script will output

aabcdef


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. I then transpose the "frequency table" (I think of transpose as some sort of generalized zip that zips a list of lists into a list of lists), 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.

golfed
Flonk
• 7.8k
• 2
• 20
• 25