input: def generateMarkov(text: str) -> str:
      """Generates a Markov chain based on the given text input and produces a generated text output.
      >>> 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, but it had no pictures or conversation?'
      """
output:     import random
      words = text.split()
      word_dict = {}
  
      for i in range(len(words) - 1):
          if words[i] in word_dict:
              word_dict[words[i]].append(words[i + 1])
          else:
              word_dict[words[i]] = [words[i + 1]]
  
      start_word = random.choice(words)
      while start_word.islower():
          start_word = random.choice(words)
  
      result = [start_word]
      current_word = start_word
  
      while current_word in word_dict:
          next_words = word_dict[current_word]
          current_word = random.choice(next_words)
          result.append(current_word)
          if result[-1][-1] in ['.', '!', '?']:
              break
  
      return ' '.join(result)