c++ differentiate between same strings with different punctuation
<p>I am writing a C++ program to count the frequency of word occurring in a text file. I am using isalpha function to separate the words, but isalpha does not differentiate between same strings having different punctuation.</p>

<p>For example: "I own a company. In my company, there are 200 employees. I love my company."
In the above sentence it gives count of company as 3
How do I make it to differentiate the count like:
company 1
company, 1
company. 1</p>

<p>The loop which does the counting:</p>

<pre><code>while(!isalpha(c) &amp;&amp; !in.eof())
    {
     c=in.get();
    }

   while(isalpha(c))
   {
   out.push_back(tolower(c));
   c = in.get();
   }
</code></pre>

<p>where 'out' is a string, 'in' is an istream value and c is a char.</p>

<p>[EDIT] Got Solution</p>

<pre><code>while(!isalpha(c) &amp;&amp; !ispunct(c) !in.eof())
        {
         c=in.get();
        }

       while(isalpha(c) || ispunct(c))
       {
       out.push_back(tolower(c));
       c = in.get();
       }
</code></pre>
