S = gets.strip S.each_char.with_index(1) { |s,i| n = S[i-1].ord - i%26 n = n<'A'.ord ? n+26 : n S[i-1] = n.chr } puts S