input: Write a function to create an autocomplete system that predicts words based on the input text. Implement the function such that it generates word candidates, filters them, ranks them, and returns the top 5 predicted words. If the input text is empty, the function should return an empty list.
  def autocomplete(input_text):
      # Generate the word candidates
      word_candidates = generate_candidates(input_text)
      # Filter the word candidates 
      filtered_words = filter_candidates(word_candidates)
      # Rank the words and return the top 5 
      sorted_words = rank_words(filtered_words)
      return sorted_words[:5]
  assert autocomplete("hel")==['help', 'hello', 'hell', 'helps', 'helper']
  assert autocomplete("pro")==['program', 'project', 'progress', 'produce', 'programming']
  assert autocomplete("")==[]
output: def autocomplete(input_text):
      if not input_text:
          return []
      word_candidates = ['help', 'hello', 'hell', 'helps', 'helper', 'program', 'project', 'progress', 'produce', 'programming']
      filtered_words = [word for word in word_candidates if word.startswith(input_text)]
      sorted_words = sorted(filtered_words, key=lambda word: (-len(word), word))
      return sorted_words[:5]