result = "" gets.chomp.split(//).each_with_index{|c, idx| result << ("A".."Z").to_a[(c.ord - "A".ord - idx - 1) % 26] } puts result