a = [] gets.chomp.split('').each_with_index do |c, i| codepoint = c.ord - (i + 1) codepoint += 26 while codepoint < 'A'.ord a << codepoint.chr end puts a.join