S = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" L = S.length puts gets.chars.map.with_index{|c,idx| S[(S.index(c) + (L - idx - 1)) % L]}.join