input: Write a function to generate a Markov chain from a given text.
  assert isinstance(generateMarkov('This is a simple test text for Markov chain generation.'), str)
  assert len(generateMarkov('Short text.')) > 0
  assert ' ' in generateMarkov('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
  from collections import defaultdict
  
  def generateMarkov(text, size=100):
      words = text.split()
      if len(words) < 2:
          return text
  
      markov_chain = defaultdict(list)
      
      for i in range(len(words) - 1):
          markov_chain[words[i]].append(words[i + 1])
  
      current_word = random.choice(words)
      result = [current_word]
      
      for _ in range(size - 1):
          next_words = markov_chain.get(current_word, words)
          current_word = random.choice(next_words)
          result.append(current_word)
  
      return ' '.join(result)