s = gets.not_nil!.chomp s.each_char_with_index do |char, i| now = char (1..(i + 1)).each do now = (now.ord - 1).chr if !('A'..'Z').includes?(now) now = 'Z' end end s = s.sub(i, now) end puts s