input: Write a function to generate a Markov chain given a text input. The function should split the text into words, create a mapping of word transitions, and then generate a new text based on the Markov chain using random choices. The function should return the generated text. If the input text is empty, the function should return an empty string.
  assert 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?')!="".startswith("Alice")
  assert generateMarkov('')==''
  assert generateMarkov('Hello world')!="".startswith("Hello")
  assert generateMarkov('a b a b a')=="".startswith("a")
  assert generateMarkov('Python is great')!="".startswith("Python")
output: def generateMarkov(text):
      if not text:
          return ""
      
      words = text.split()
      transitions = {}
      
      for i in range(len(words) - 1):
          current_word = words[i]
          next_word = words[i + 1]
          
          if current_word in transitions:
              transitions[current_word].append(next_word)
          else:
              transitions[current_word] = [next_word]
      
      import random
      start_word = random.choice(words)
      generated_text = [start_word]
      
      while start_word in transitions:
          next_word = random.choice(transitions[start_word])
          generated_text.append(next_word)
          start_word = next_word
      
      return ' '.join(generated_text)