# The Zodiac Killer 340 cipher
# Character frequency
# By jonelf¤gmail.com
# Background: http://www.re-quest.net/mystery/zodiac/index.htm
# Thanks to Chris McCarthy
# http://www.dtm.ciw.edu/chris/z/
# http://www.dtm.ciw.edu/chris/z/340.ascii
# http://www.dtm.ciw.edu/chris/z/strange.char.txt
# Ruby - http://www.ruby-lang.org/
crypto="HER>pl^VPkI1LTG2dNp+B(#O%DWY.<\Kf)By:cM+UZGW()L#zHJSpp7^l8\V3pO++RK2_9M+ztjdI5FP+&4k/p8R^FlO-\dCkF>2D(#5+Kq%;2UcXGV.zLI(G2Jfj#O+_NYz+@L9d<M+b+ZR2FBcyA64K-zlUV+^J+Op7<FBy-U+R/5tEIDYBpbTMKO2<clRjI\5T5M.+&BFz69Sy#+NI5FBc(;8RlGFN^f525b.cV5t++yBX1\:49CE>VUZ5-+Ic.3zBK(Op^.fMqG2RcT+L52C<+FlWBI)L++)WCzWcPOSHT/()pIFkdW<7tB_YOB\-Cc>MDHNpkSzZO8AIK;+"
ca=crypto.split("")
csorted=ca.sort
before=""
i=0
frt = Array.new
# Get character frequence
for ch in csorted
i+=1
if before!=ch then
frt << [ch, i]
# puts ch + ", "+ i.to_s
i=0
end
before=ch
end
# Sort the array on frequence
sfrt=frt.sort {|x,y| y[1]<=>x[1]}
puts "Crypto length:" + ca.length.to_s
puts "Unique chars: " + ca.uniq.length.to_s
puts
for ch in sfrt
puts ch[1].to_s + ", " + ch[0]
end