class Calc0018 def initialize args = STDIN.readlines.map { |l| l.chomp.split(/\s+/) } @s = args.shift.first end def calc @s.split(//).map.with_index { |c, i| ((((c.ord - ?A.ord) - (i + 1)) % 26) + ?A.ord).chr }.join end def run puts calc end end Calc0018.new.run if __FILE__ == $0