input: from typing import List
  
  def generate_markov_chain(text: str) -> str:
      """ This function will take a text as input and generate a 
      Markov chain based on the words in the text. The function will return a 
      generated text which is a result of the Markov chain.
      Example:
      for generate_markov_chain('Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, `and what is the use of a book,' thought Alice `without pictures or conversation?') == 'Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, and what is the use of a book, thought Alice without pictures or conversation?'
      """
  
output:     import random
  
      words = text.split()
      word_dict = {}
  
      for i in range(len(words) - 1):
          if words[i] in word_dict:
              word_dict[words[i]].append(words[i + 1])
          else:
              word_dict[words[i]] = [words[i + 1]]
  
      current_word = random.choice(words)
      result = [current_word]
  
      for _ in range(len(words) - 1):
          if current_word in word_dict:
              next_word = random.choice(word_dict[current_word])
              result.append(next_word)
              current_word = next_word
          else:
              break
  
      return ' '.join(result)