input: 
  from typing import List
  
  
  def generateMarkov(text: str) -> str:
      """ Generate a Markov chain text based on the given input text. The function creates a
      dictionary where each word in the input text is a key and its value is a dictionary of
      words that follow it, with counts of their occurrences. The function then generates a
      random text of 100 words (or as many as the chain allows) starting from a random word.
      >>> 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 conversation, \'and what is the use of a book,\' thought Alice \'without pictures or conversation?\''
      """
  
output:     
      import random
      from collections import defaultdict
  
      words = text.split()
      chain = defaultdict(lambda: defaultdict(int))
  
      for i in range(len(words) - 1):
          chain[words[i]][words[i + 1]] += 1
  
      current_word = random.choice(words)
      result = [current_word]
  
      for _ in range(100):
          if current_word not in chain:
              break
          next_words = list(chain[current_word].items())
          if not next_words:
              break
          next_word, count = random.choices(next_words, weights=[c for _, c in next_words])[0]
          result.append(next_word)
          current_word = next_word
  
      return ' '.join(result)
  