title: Replacing Exclamation with Dot in a string
body: <p>I'm asked to replace all the exclamations with dots in a string. I came up with a function but i'm getting an error because it doesn't change the last exclamation. It is just the last exclamation. </p>
  
  <p>The input is:</p>
  
  <p>We'll continue our quest in space. There will be more shuttle flights and more shuttle crews and, yes, more volunteers, more civilians, more teachers in space. Nothing ends here; our hopes and our journeys continue!</p>
  
  <p>My function is:</p>
  
  <pre><code>string ReplaceExclamation(string text)
  {
  string newText = text;
  int i, len = text.size();
  
  for(i=0; i&lt;len; i++)
  {
  
  if(text[i] == '!')
  newText[i] = '.';
  }
  return newText;
  }
  </code></pre>
  
  <p>Does anybody know how to hardcore it since it's just the last exclamation.
  Thanks</p>