title: Comparing last word in line (added to vector each word as different element) with typing word C++
body: <p>I'm making one of my firsts programs in cpp. 
  In short, small game. Rule of that round is to choose random word from line, replace it with "...", ask for typing word and check if it is the same word as the word before replacing.
  I have problem only in situation the last word is replaced. Even if I write the same word, I get answer it's not alright. Checked it on debug and I can not see ant different between replacing last word or any other word. As I wrote, not working only with last word from the line.</p>
  
  <p>Logic: Read lines from file, add them to vector.
  Choose one random line, add word by word to next vector erasing all spaces, choose random word,
  replace, print sentence, type, compare.</p>
  
  <pre><code> vector&lt;string&gt; thirdRoundSentences;
   vector&lt;string&gt; arrayWithOneLineStrings;
   string chosenLine;
   string wholeSentenceLine;
   string delimiter;
  </code></pre>
  
  <pre><code>  ifstream fileRoundThree("../../langGame/roundThree.txt");
  
      while (getline(fileRoundThree, line)) {
          thirdRoundSentences.push_back(line);
      }
      fileRoundThree.close();
  }
  </code></pre>
  
  <pre><code> srand(time(0));
      random = rand() % thirdRoundSentences.size();
  
      wholeSentenceLine = thirdRoundSentences[random];
      chosenLine = wholeSentenceLine;
      delimiter = " ";
  
      size_t pos = 0;
  
      while ((pos = wholeSentenceLine.find(delimiter)) != std::string::npos) { 
          token = wholeSentenceLine.substr(0, pos);
          wholeSentenceLine.erase(0, pos + delimiter.length());  //erase word one by one from whole sentence
          arrayWithOneLineStrings.push_back(token);
      }
      arrayWithOneLineStrings.push_back(wholeSentenceLine); //add last left word to vector
  
      srand(time(0));
      random = rand() % arrayWithOneLineStrings.size();
  
      token = arrayWithOneLineStrings[random];
  
      if (chosenLine.find(token) != string::npos) {
          chosenLine.replace(chosenLine.find(token), token.size(), "...");
      }
  
      cout &lt;&lt; "\n" &lt;&lt; chosenLine&lt;&lt; "\n";
      cin &gt;&gt; typeWord;
      arrayWithOneLineStrings.clear();
  
      if (typeWord == token) {
          scorer.addPoints();
      } else {
  </code></pre>
  
  <p>This is what I'm talkin about. Print</p>
  
  <pre><code>Piece of ...
  cake  //typed word
  
   Wrong!
  
   Right answer is: cake  
  </code></pre>