x=("a".."z").to_a h=Hash[x.zip(x.reverse)] ans="" gets gets.chomp.each_char{|e| ans+=h[e] } puts ans