input: 
  def generateMarkov(text: str) -> str:
      """ Generates a Markov chain text based on the input text.
      The function will create a dictionary where each word is a key 
      and the value is another dictionary mapping words that follow 
      the key to the number of times they appear. The resulting chain
      is then used to generate a new text based on the probabilities
      of word succession.
      
      >>> 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?')
      'bank, and of having nothing to do: once or twice she had peeped into the book her sister 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 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 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 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 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...'
      """
  
output:     
      import random
  
      words = text.split()
      markov_dict = {}
  
      for i in range(len(words) - 1):
          current_word = words[i]
          next_word = words[i + 1]
          
          if current_word not in markov_dict:
              markov_dict[current_word] = {}
          
          if next_word not in markov_dict[current_word]:
              markov_dict[current_word][next_word] = 0
          
          markov_dict[current_word][next_word] += 1
  
      current_word = random.choice(list(markov_dict.keys()))
      result = [current_word]
  
      for _ in range(len(words) - 1):
          if current_word not in markov_dict:
              break
          
          next_words = markov_dict[current_word]
          next_word = random.choices(list(next_words.keys()), weights=list(next_words.values()))[0]
          result.append(next_word)
          current_word = next_word
  
      return ' '.join(result)
  