def decode(st, n)
  trans = ->(b) {(a = b - n) < 97 ? 122 - (96 - a) : a}
  st.bytes.map {|b| (b.between?(97, 122) ? trans.(b) : b).chr}.join
end

words = %w(the this that)
table = (0..25).map do |i|
  words.map {|w| w.bytes.map {|b| ((a = b + i) > 122 ? (a - 123 + 97) : a).chr}.join}
end

$<.readlines.each do |st|
  st.chomp!
  n = 0
  table.each_with_index do |ws, i|
    ws.each {|w| n = i if st.include?(w)}
  end
  puts decode(st, n)
end
