title: Replace all middle characters in a string c++
body: <p>I know I have asked a question similar to this in the not to distant past and I am sorry for asking a similar one but I can work out how do do this one thing with my code. I want to leave the first and last character in a string as they are and replace all the characters in the centre.</p>
  
  <pre><code>// finds all banned words
  size_t pos = textWords[i].find(bannedWords[j]); 
  
  // checks through the vector to find all words in the banned list
  if (string::npos != pos) 
  {
      // replaces the middle character with a *
      textWords[i].replace(pos + 1 , 1 , 1 , '*'); 
  }
  </code></pre>
  
  <p>This is the code that i am using it works but it only works with three lettered words and i want it to work with any length of word.</p>
  
  <p>Again I am sorry for asking a similar question to one I asked before but I am stuck with this.</p>