r=[*?A..?Z]
x=Hash[(r+" .,-'?".chars).zip (0..31).map{|i|"%05b"%[i]}]
y=/1(1.|0(1|0(0|1....)))|0(1(1.|0(1|0(1|0.)))|0(1..|0(1|0..)))/
z=Hash["dggigggieedfigeiefiifdieffiigiii".bytes.map{|i|i-97}.zip("836$D4X-849<.C:+97,18:2;9:/05%&#".bytes.map{|c|c<51?c+109:c-51}).map{|a|"%0*b"%a}.zip" ',-.?".chars+r]
puts$<.map{|l|l.gsub(/./,x).gsub(y,z).delete ?0}