title: Error, return value 3221225477
body: <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;vector&gt;
  using namespace std;
  
  vector &lt;string&gt; words; 
  
  void splitSent (string sent);
  
  
  
  int main ()
  {
  string sent;
  
  cout &lt;&lt; "Enter your sentence: " &lt;&lt; endl;
  getline (cin, sent);
  splitSent (sent);     
  
  
  string finalSent;
  for (unsigned int i = 0; i &lt; words.size(); i++)
   {  
      if (words[i] == "i")
      {
          finalSent += "I ";
          i++;
      }
  
      if (words[i] == "instructor")
      {
          finalSent += "name of prof ";
          i++;
      }
  
      finalSent += words[i];
      finalSent += " ";
   }
  
  cout &lt;&lt; "Final sentence is: " &lt;&lt; finalSent &lt;&lt; "." &lt;&lt; endl;
  
  
  return 0;
  }
  
  
  void splitSent (string sent)
  {
  int Pos = 0; // Position
  string word;
  
  while (Pos &lt; sent.length())
  {
      while ((Pos &lt; sent.length()) &amp;&amp; (sent[Pos] != ' '))
      {
          word += sent[Pos];
          Pos++;
          if (sent[Pos] == '.')
           {
              break;
           }
      };
  words.push_back(word);
  word = "";
  Pos++;
  }
  }
  </code></pre>
  
  <p>This is my program so far, I'm trying to replace "i" with "I" and replace "instructor" with the name of my prof. However, every time there is more than two "i"s in a sentence, I keep getting an error message and I'm not sure why. I also get the same error message if there is the word "instructor" in my sentence</p>