title: How to find the most repeated word?
body: <p>How can make the program to print the most repeated word? For now it prints as follow:</p>
  
  <blockquote>
    <p>Input:
    apple banana apple apple</p>
    
    <p>Output:</p>
    
    <p>apple appeared 3 times</p>
    
    <p>banana appeared 1 times</p>
  </blockquote>
  
  <pre><code>int main() {
          string words;
          vector&lt;string&gt; stringHolder;
  
          while (cin &gt;&gt; words)
          {
              stringHolder.push_back(words);
          }
          sort(stringHolder.begin(), stringHolder.end());
  
          int vSize = stringHolder.size();
          if (vSize == 0) {
              cout &lt;&lt; " no words ";
          }
          int wordCount = 1;
          words = stringHolder[0];
          for (int i = 1; i&lt;vSize; i++) {
              if (words != stringHolder[i]) {
                  cout &lt;&lt; words &lt;&lt; " appeared " &lt;&lt; wordCount &lt;&lt; " times" &lt;&lt; endl;
                  wordCount = 0;
                  words = stringHolder[i];
              }
              wordCount++;
          }
          cout &lt;&lt; words &lt;&lt; " appeared " &lt;&lt; wordCount &lt;&lt; " times" &lt;&lt; endl;
          system("pause");
      }
  </code></pre>