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

Haskell, 183 162 162159

Assuming the file is in file.txt!

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

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.

Haskell, 183 162

Assuming the file is in file.txt!

import Data.Char
import Data.List
d=drop 1
main=readFile"file.txt">>=putStr.concat.d.map(d.maximum).transpose.map(group.sort.(++' ':['a'..'z'])).lines.map toLower

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.

Haskell, 183 162 159

Assuming the file is in file.txt!

import Data.Char
import Data.List
main=readFile"file.txt">>=putStr.concat.tail.map(tail.maximum).transpose.map(group.sort.(++' ':['a'..'z'])).lines.map toLower

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.

added 691 characters in body
Source Link
Flonk
  • 7.8k
  • 2
  • 20
  • 25

Haskell, 183 162

Assuming the file is in file.txt!

import Data.Char
import Data.List
d=drop 1
main=readFile"file.txt">>=putStr.concat.d.map(d.maximum).transpose.map(group.sort.(++' ':['a'..'z'])).lines.map toLower

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.

Haskell, 183 162

Assuming the file is in file.txt!

import Data.Char
import Data.List
d=drop 1
main=readFile"file.txt">>=putStr.concat.d.map(d.maximum).transpose.map(group.sort.(++' ':['a'..'z'])).lines.map toLower

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.

Haskell, 183 162

Assuming the file is in file.txt!

import Data.Char
import Data.List
d=drop 1
main=readFile"file.txt">>=putStr.concat.d.map(d.maximum).transpose.map(group.sort.(++' ':['a'..'z'])).lines.map toLower

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.

added 691 characters in body
Source Link
Flonk
  • 7.8k
  • 2
  • 20
  • 25

Haskell, 183 162

Assuming the file is in file.txt!

import Data.Char
import Data.List
d=drop 1
main=readFile"file.txt">>=putStr.concat.d.map(d.maximum).transpose.map(group.sort.(++' ':['a'..'z'])).lines.map toLower

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.

Haskell, 183 162

Assuming the file is in file.txt!

import Data.Char
import Data.List
d=drop 1
main=readFile"file.txt">>=putStr.concat.d.map(d.maximum).transpose.map(group.sort.(++' ':['a'..'z'])).lines.map toLower

If file.txt contains, for example

abcde
abcdef
aaf

The script will output

aabcdef

Haskell, 183 162

Assuming the file is in file.txt!

import Data.Char
import Data.List
d=drop 1
main=readFile"file.txt">>=putStr.concat.d.map(d.maximum).transpose.map(group.sort.(++' ':['a'..'z'])).lines.map toLower

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
Source Link
Flonk
  • 7.8k
  • 2
  • 20
  • 25
Loading
added 2 characters in body
Source Link
Flonk
  • 7.8k
  • 2
  • 20
  • 25
Loading
Source Link
Flonk
  • 7.8k
  • 2
  • 20
  • 25
Loading