input: def generateMarkov(text: str) -> str:
      """Generates a Markov chain from the given text input to produce a generated text of approximately 100 words.
      >>> 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?')
      'beginning to get very tired of sitting by her sister on the bank, and of having nothing to do:... (output truncated for brevity)'
      """
output:     import random
      import re
  
      def build_markov_chain(text):
          words = re.findall(r'\w+|\W+', text)
          chain = {}
          for i in range(len(words) - 2):
              pair = (words[i], words[i + 1])
              next_word = words[i + 2]
              if pair in chain:
                  chain[pair].append(next_word)
              else:
                  chain[pair] = [next_word]
          return chain
  
      def generate_text(chain, length=100):
          pair = random.choice(list(chain.keys()))
          result = list(pair)
          while len(result) < length:
              if pair in chain:
                  next_word = random.choice(chain[pair])
                  result.append(next_word)
                  pair = (pair[1], next_word)
              else:
                  break
          return ''.join(result)
  
      markov_chain = build_markov_chain(text)
      generated_text = generate_text(markov_chain)
      return generated_text