You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
advent-of-code/2016/ruby/day_06.rb

608 lines
5.5 KiB

counts = Array.new(8) { Hash.new(0) }
DATA.read.lines.each.with_object(counts) do |line, counts|
(0..7).each do |i|
counts[i][line[i]] += 1
end
end
p counts.map {|h| h.sort_by(&:last).first.first }.join
__END__
eqvmfqnf
jvkezmqt
zcssqwlw
cuacncgg
ikmpzpoh
dzpzobdl
qlsnuhuq
fwqnoklz
cibgplfq
ktsqfcrv
vcknjnnx
upaiaprz
bpqmolbq
dflhnpnk
heqjflch
cmewgodc
aaorgxkn
plekphpw
fcofrbnm
bmnrygtb
rqsqsqio
rnlntwxa
cxjqqfyl
jxjnxchb
kfgutxmi
cbciszxd
irakoonu
pcgfnycg
fgeivexo
ujxdaehw
ejkvrych
nhlklbgr
etjuhgry
mkgkmykm
teuhrfto
juqfslbn
tbwxabzi
ngdnwsey
amcibkyo
xlvxwqpj
vdbzuvkh
gkagbzep
kqxzkeip
bxccztho
vqrywqlc
jbzhecjc
ozkulgxo
uiwbofuk
vfwhdnao
tycxucwd
jvhuljfs
xxhqhruc
upnndiiz
andxywil
lowofbqv
iroqzrry
nmkkqqjb
daijrfna
jmcstxlq
jdefvuaa
nkbmowfi
agotazda
kufoymrn
yijwfjyi
hyqvaouj
soueuhln
oomsbkmh
buadtssf
rvgpeeza
hjiymcmd
ebgivdap
xzieipbg
ttpudwqt
hndwuncw
wqypfkvf
jqxuaipm
fzwlgxxq
ddshbtya
ardlcgyi
soznvuyw
vyizuolp
ckfaxyvs
nbsjkibi
lsrkrdzp
oqoffwxa
bdugjlsm
rtcsylfd
fezoiliq
zwpaphcb
sdlouhyf
cfejwvls
xehddxku
edhrtdcv
ehouagvy
hoyxjfsj
quggpnpx
muqbijbe
rcnniddd
kzfeiaui
sywienef
xpxftuvq
dtbhnslt
mpcpkmfa
wysutlci
fmqomicz
mhshprxr
uxwfcftt
ehbonsrl
pjobilxx
chiebfox
lqfxgyqg
vupcjatm
wfljafhc
iygojeny
gqxmgneu
nhlwllak
xnkqpulv
awijbvef
pbcrrwqo
dobsejtb
dqdoapkc
hngrxdtx
dodsxysb
bmtyelak
cctuwwvt
rytlmoyr
fqnbuxdi
irrqladc
wnvtsneg
ugqqdmlj
nljnjiod
knidxxzh
dfymoqgt
fwgtjafh
fpdioivz
tqbewmti
mcqtbbee
pivfrpou
tdyguuos
eldmvvmi
oaiqnizz
fyqpxgwa
lzcxsazq
zhsoljwz
qnzafmjl
oopnnndl
cozehoor
bspuwzxm
ubtunnep
smdhpvxr
nsvxiwje
mmqcklsm
hhxaciaq
zzgoxhws
fvntouun
skxzmzyg
znptwuqu
aknwvojo
wftmjrsf
gahrordj
oegnykag
lvlqswph
qsowvoem
sjspasfp
ygjohzfd
jeuxigsi
lgxdtudx
qadlkrel
lpfxosdq
sgaoqkzr
rtlvuhfv
ftbbsgbn
kjxttiqu
gylikswu
lquhgmrs
hxrjagjm
epxxekgx
uwwlcbrx
feincdjp
uyxhfhsc
nojuykoh
psjuuqwu
gtlohqkz
sbzsbgrw
nbhwuxfb
phmtunrh
zmfbkvgv
mjumfpia
gkubcshe
jmavrhyd
cgffkftg
msurhdct
bvchukal
psxaluvg
tvgwjhhp
chyizcxv
dumebzkd
cjpzbkzk
ngrgseyn
xmwcmaaz
puyrbiup
xxkpznis
rguwrpua
jmolhvnn
kpeqtlan
zzgvoxlp
erbintcn
kcykvysv
ixildajc
tnvgihwe
iqwgozpj
txkgyflb
vsyzebrw
ehnbcjef
hfevkbhf
wihlqtmp
vmrmnygo
ulvsuvsn
wgxnwihd
lexgbpsv
kxqcjoeb
daodpsbb
azyqmyhv
mvzcatwb
jtvqkjrv
rtdsaqqd
xrhzmnzl
wgfiwjrh
hgrgqqxm
nwwcxoyq
qlqyhpzs
ovujfily
pzvyeryk
strswprn
nrxclypc
sfusjxzi
pclbdadw
sjhggndb
xjcutuyt
qjjjeytj
qqjrkdlb
pyzodjdh
brnmlkmi
lgipidfp
ttrfbjry
iidwekro
vnwlnyma
ylxatduo
eiokdbqr
laezjjte
kkjhfsvp
buaegtpg
vzgqletc
pkdseade
nvpyxokq
yiysgxpe
xqhtubam
lcstpvke
nnskqssg
mkrbdovg
camkeppm
iqjvotay
bodlfgkj
jiigwvzc
ixpghywy
qlzyjgue
ugyjqtzn
odeuuiir
yfhianfx
seewayqj
lstpeuja
paqqnxsr
guwkidny
susussgu
ezcayehr
tdzgvcqf
vckcnsio
obawbapm
ipebazzk
tmcpmiou
hpdlfwor
ygxlfzzr
ltyxhtbx
olzqonbx
grsxreqs
bvkjcoux
fxtuxuub
fcbxdenm
smilcfvz
ewbndkiz
httsnfqu
ghorvefw
anevvqir
sajdzwho
becdemdn
vxktmxsj
xyawkeuw
pdefbxmh
yejymgfr
mipvhnsc
tjdyqpzd
rbvqirmd
mscuflvd
draqqcda
xfegqcjg
auypywpb
gitgzstq
zveqbzgt
wxrpedre
haptyecu
tkeexmhe
ujijprbd
xjiyczwq
ehpygnrr
guvejwyt
zmtsftky
wqtklwiz
lwlessio
lrknmhzd
pkdkwevt
ncryoeth
hjsqtpxu
ivmqrwok
qozgijgu
ueujvbbe
nfxgrmsd
zeetrgdl
drfbcgxo
rjjeraeb
hshozlgv
sfgvrnez
zaoctlsa
hebtzqvy
qckvuyif
wxyszmev
ddxfwklt
jqlzpfvu
wimoefwx
kabvtrno
pbebkvkm
govfwjof
xfjkvoup
fuzxcese
zbavvmyy
mwvkrnjg
gtkyelff
bffyzhnt
vlffqryw
ofncqcqw
cnzzrjjj
txpzvykz
ukkgeavq
wdnieioq
avosnedk
ipaavrqp
eeuurfat
sfhhwqzw
vjzopzad
kdbjonqz
uaksjfuc
lumpaomf
ysebmwel
dobryhxj
oaymjqwh
qjfflojj
zqmfgwre
uimjngfs
ihwelccg
yetrodjy
aifvwtws
xiyruzqr
anuvhykm
lelbjsno
csjwqotd
pptsysey
joptcdmq
tghbxpmq
jduwbxiy
obcdlahg
dxwrzytc
axfrxlgz
gepnmvel
ztmcynch
otnicgga
bdzobaoe
vkljxwnm
qvhmitgh
yflyxbjn
qshihqki
debaxqpw
fhfcjogj
huwpnaxx
jpwnrjbc
waylsrcm
aurdpcqc
yanpouht
ybwbpcak
uzvvspnj
tftluckv
uwmditoa
wsndxybi
dotcxasi
lxgmptwn
bpdmcbgt
dpjqvvck
jmgwudli
rimvxcoa
vdlacqbl
qtzwuqny
olzuzuuq
grlyyegi
mhgtadti
yrfdffzj
wbxadryy
bhaniozq
jdishqcx
kmiatkjj
asmxdrmv
riqdknna
fsuetmeg
iikajhgb
ioswsaws
yygpvtfb
egjoltik
bypcbzpk
zaumpggx
sdizezlv
xoyallwy
gicvajdl
qzowhuxa
iyftbzns
srzjxhve
xwasqzay
qznuxpqj
mlnjztxf
rxkcymao
huvxpllx
fmnrqasq
mwwigmka
yovjkmou
kvdrltte
nymvepew
vnrjykzc
unoegpvv
trrejbob
zwsdnqnb
ljsztmgl
tiznomfv
zxtxholt
csufzpiw
jgbjpucz
mpakkeil
ixmbvvbi
ejkhcxjj
zaokljpl
oeocaxdv
ytlpsbcx
hpfserxf
nzregysc
etevckof
bcqkqdvb
xzdhhick
gystpgoo
ciiyzxxr
kwstdxnn
ztregxhx
qhvkjoqe
ugirgwax
nhukpdut
yfiibmmd
cwkayjcp
ebmlabrp
kvjhyrag
wbphpfkc
ucqvhibs
dwuavsyy
jwrdsobl
hytijctt
plcumjhv
hwexsihm
ppmfzgqt
moumyuiw
zvgbsabj
yraygmws
vopzuhor
hafhljwp
gmqpchdg
yyahpihs
xvqakyyp
deamarun
yunihcvw
gcdjqqmu
kctibuxy
gcvlcfhc
ydwoxfvg
epszfvuh
xjjvwpbz
gzpdnthj
mnkrjgwz
ldfwvvfq
tydqesvl
envwzaqv
xvwyzkpe
rmpgcjeo
pkupgxup
ekqizsjl
agvenhgu
vscaqtri
rwfjrjpg
imthkcta
sjpmwqmg
fptfgekn
ohbwdbjm
ccfrphaj
gyeaqkog
onybscve
qztmoant
abjnbrpd
zompdzuf
bamomvbw
kzmmgexu
wzoxohtn
wvgmvwdt
nlgkxmbu
vyoddxyf
phmrizhk
zhksysjf
atcfvzlx
iyabqkly
rnwidjpm
cgwddumw
fcoylnzw
lsxosfra
vbcdgfiw
aenlmdgh
fvtmormn
rllxkznc
asocydmo
zcltimlr
hrqmccpt
dfmlsvtz
ntuhkbws
oziqleds
wkzbguis
coapfihl
irzpsuql
uxaowrls
tdbefhcf
wsyusuph
lpbdrmyn
slrzkkms
wqvzwiyq
vinahrsd
thsnmqjr
kwrzmakz
ifhclifl
wkqahikb
rwnchlkr
rkhpdbbk
vqnzigbf
olzziafs
qcylpbtk
fzhtmgji
qvnyctmb
ouolgwup
xkbrykjx
apbamszk
mlrlmpoh
kdneakuk
rrhhrtfk
cbgzlbgz
mfxencal
bkctqwpe
rjdxhqof
ogcbntmp
bbftqdfk
kikdidvm
mnjgwven
yurxwsge
qlrdtzad
jalffvnu
tayfycwr
jhivnvaw
yuvffepz
mwhczdkv
xltzklis
iellkyqk
krpktxhh
rkawdywu
pqqitomj
nrhhtvtv
gwerzhwc
qlsgifir
ssvyspem
udnnmvxk
albkdbsh
obxcrucu
dnyytrcx