input: Write a function to count the number of words and characters in a string.
  assert count_words_and_characters('Francesco is learning to code') == (26, 5)
  assert count_words_and_characters('Hello world!') == (11, 2)
  assert count_words_and_characters('  Leading and trailing spaces  ') == (27, 5)
output: def count_words_and_characters(s):
      words = s.split()
      num_words = len(words)
      num_chars = len(s.replace(" ", ""))
      return num_chars, num_words