title: C++: Removing all asterisks from a string where the asterisks are NOT multiplication symbols
body: <p>So basically, I might have some string that looks like: "hey this is a string * this string is awesome 97 * 3 = 27 * this string is cool".</p>
  
  <p>However, this string might be huge.  I'm trying to remove all the asterisks from the string, unless that asterisk appears to represent multiplication.  Efficiency is somewhat important here, and I'm having trouble coming up with a good algorithm to remove all the non-multiplication asterisks from this.  </p>
  
  <p>In order to determine whether an asterisk is for multiplication, I can obviously just check whether it's sandwiched in between two numbers.</p>
  
  <p>Thus, I was thinking I could do something like (pseudocode):</p>
  
  <pre><code>wasNumber = false
  Loop through string
     if number 
        set wasNumber = true
     else
        set wasNumber = false
     if asterisk
        if wasNumber
           if the next word is a number
              do nothing
           else
              remove asterisk
        else
           remove asterisk
  </code></pre>
  
  <p>However, that^ is ugly and inefficient on a huge string.  Can you think of a better way to accomplish this in C++?</p>
  
  <p>Also, how could I actually check whether a word is a number?  It's allowed to be  a decimal.  I know there's a function to check if a character is a number...</p>