input: Write a python function to convert numbers to words.
  assert num_to_word(5) == 'five'
  assert num_to_word(15) == 'fifteen'
  assert num_to_word(55) == 'five five'
  assert num_to_word(123) == 'one hundred twenty three'
output: def num_to_word(num):
      units = ["", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]
      teens = ["", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"]
      tens = ["", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]
      thousands = ["", "thousand"]
  
      def word(n):
          if 0 <= n < 10:
              return units[n]
          elif 10 < n < 20:
              return teens[n - 10]
          elif 10 <= n < 100:
              return tens[n // 10] + (" " + units[n % 10] if n % 10 != 0 else "")
          elif 100 <= n < 1000:
              return units[n // 100] + " hundred" + (" " + word(n % 100) if n % 100 != 0 else "")
          elif 1000 <= n < 10000:
              return units[n // 1000] + " thousand" + (" " + word(n % 1000) if n % 1000 != 0 else "")
          return ""
  
      if num == 0:
          return "zero"
      return word(num)