title: remove white space between specific characters using regex in python
body: <p>I am trying to use regex to remove white spaces in the sequence of consecutive '?' and/or '!' in a string. One example is that "what is that ?? ? ? ?? ??? ? ! ! ! ? !" should be changed to "what is that ??????????!!!?!". That is, I want to concatenate all '?' and '!' without space in between. My current code doesn't work out well: </p>
  
  <pre><code>import re
  s = "what is that ?? ? ? ?? ??? ? ! ! ! ? !"
  s = re.sub("\? +\?", "??", s)
  s = re.sub("\? +\!", "?!", s)
  s = re.sub("\! +\!", "!!", s)
  s = re.sub("\! +\?", "!?", s)
  </code></pre>
  
  <p>which produces 'what is that ??? ???????!! !?!', where some spaces are obviously not deleted. what is going wrong in my code and how to revise it? </p>