input: from typing import List
  
  
  def generateMarkov(text: str) -> str:
      """ Generate a Markov chain from a given text input. The function will split the text
      into words and create a dictionary where each word maps to a dictionary of words that 
      follow it, with counts of their occurrences. The function then generates a new text 
      based on the Markov chain by randomly choosing the next word based on the probabilities.
      
      >>> 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?')
      '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
  
      words = text.split()
      markov_dict = defaultdict(lambda: defaultdict(int))
  
      for i in range(len(words) - 1):
          current_word = words[i]
          next_word = words[i + 1]
          markov_dict[current_word][next_word] += 1
  
      current_word = random.choice(words)
      result = [current_word]
  
      for _ in range(len(words) - 1):
          next_word_options = markov_dict[current_word]
          if not next_word_options:
              break
          next_word = random.choices(
              list(next_word_options.keys()), weights=next_word_options.values(), k=1
          )[0]
          result.append(next_word)
          current_word = next_word
  
      return ' '.join(result)
  