input: Write a function to generate a Markov chain given a text input. The function should take a string of text as input and return a generated text based on the Markov chain model, which is constructed from the input text. If the input text is empty, the function should return an empty string.
  assert generateMarkov('Alice was beginning to get very tired')=='begining to get very tired Alice to get very tired Alice was get very tired Alice was beginning'
  assert generateMarkov('The quick brown fox jumped over the lazy dog')=='brown fox jumped over the lazy dog over the lazy dog over the lazy dog The quick the lazy dog The quick brown'
  assert generateMarkov('')==''
output: def generateMarkov(text):
      if not text:
          return ''
      
      words = text.split()
      if len(words) < 2:
          return text
      
      import random
      from collections import defaultdict
      
      markov_dict = defaultdict(list)
      
      for current_word, next_word in zip(words, words[1:]):
          markov_dict[current_word].append(next_word)
      
      current_word = random.choice(words)
      result = [current_word]
      
      for _ in range(len(words) - 1):
          next_word = random.choice(markov_dict[current_word])
          result.append(next_word)
          current_word = next_word
      
      return ' '.join(result)