@hints = { 4 => ['this', 'that'], 3 => ['the'] }

def g(s)
  s.chop.split.each { |w| 
    hint = @hints[w.size]
    next if hint.nil?
    hint.each { |h| 
      c = 0.upto(w.size - 1).map { |i| h[i] - w[i] }.uniq
      return c.shift if c.size == 1
    }   
  }
  return 0
end

while s = gets
  d = g(s)
  0.upto(s.size - 1).each { |i| s[i] += d if s[i] >= 97 && s[i] <= 120 }
  puts s
end