ALPHABET = %w(a b c d e f g h i j k l m n o p q r s t u v w x y z)

def get_index_number(char)
  ALPHABET.each.with_index do |al, idx|
    return idx - 1 if char == al
  end
  raise 'No index'
end

while str = gets
  break if str.nil? || str.empty?
  0.upto(25) do |i|
    text = ''
    str.split('').each do |c|
      if c =~ /[a-z]/
        text << ALPHABET[(get_index_number(c) + i) % 26]
      else
        text << c
      end
    end

    if text.split(' ').any? { |w| %w(the this that).include?(w) }
      puts text
      break
    end
  end
end