input: Write a function to generate a Markov chain from a given text input. The function should take a string as input, split it into words, and build a Markov chain dictionary where each word maps to a dictionary of subsequent words along with their frequency. The function should then generate a new text by randomly following the Markov chain, starting from a random word and continuing for a given number of iterations. Return the generated text as a 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?')
output: import random
  
  def generateMarkov(text):
      words = text.split()
      markov_chain = {}
      
      for i in range(len(words) - 1):
          current_word = words[i]
          next_word = words[i + 1]
          
          if current_word not in markov_chain:
              markov_chain[current_word] = {}
          
          if next_word not in markov_chain[current_word]:
              markov_chain[current_word][next_word] = 0
          
          markov_chain[current_word][next_word] += 1
      
      start_word = random.choice(list(markov_chain.keys()))
      generated_text = [start_word]
      
      for _ in range(100):
          current_word = generated_text[-1]
          if current_word not in markov_chain:
              break
          
          next_words = markov_chain[current_word]
          next_word = random.choices(list(next_words.keys()), weights=list(next_words.values()))[0]
          generated_text.append(next_word)
      
      return ' '.join(generated_text)