title: Replace a pattern in C++ 98
body: <p>I need to do in place replacement in a string for a specific pattern 
  Example:  </p>
  
  <p>Input:</p>
  
  <pre>temp.temp2..temp3....temp4......temp5</pre>
  
  <p>Output:</p>
  
  <pre>temp.temp2.temp3.temp4.temp5</pre>
  
  <p>So basically if it is single dot, leave as it is , but if there are more consecutive dots, replace them with a single dot.</p>
  
  <p>I tried iterating the string and copying into another string objects based on comparisons, and it looks real ugly now.
  I wonder any better way using C++ STL?</p>