Exercise from Accelerated C++ I am working through the exercises in the book Accelerated C++.  I wanted to get some feedback on proper use of the Standard Library, correctness, overall style, portability, etc.

/*******************************************************************************
Accelerated C++ Chapter 3

Write a program to count how many times each distinct word appears in its input
*******************************************************************************/

#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;string&gt;

int main()
{
    std::cout &lt;&lt; "Enter a list of words followed by end-of-file: ";

    typedef std::vector&lt;std::string&gt;::size_type vector_sz;
    std::vector&lt;std::string&gt; words;
    std::string word;
    while (std::cin &gt;&gt; word)
    {
        words.push_back(word);
    }

    vector_sz size = words.size();
    if(size == 0)
    {
        std::cout &lt;&lt; "Please enter some words!";
        return -1;
    }

    std::vector&lt;int&gt; frequency;
    std::vector&lt;std::string&gt; unique_words;
    int count = 0;
    bool isUnique;

    unique_words.push_back(words[0]);

    for(unsigned i = 0; i &lt; words.size(); ++i)
    {
        isUnique = true;

        for(unsigned j = 0; j &lt; unique_words.size(); ++j)
        {
            if(words[i] == unique_words[j])
            {
                isUnique = false;
            }
        }
      if(isUnique)
      {
          unique_words.push_back(words[i]);
      }
    }

    for(unsigned i = 0; i &lt; unique_words.size(); ++i)
    {
        for(unsigned j = 0; j &lt; words.size(); ++j)
        {
            if(unique_words[i] == words[j])
            {
                count += 1;
            }
        }
        frequency.push_back(count);
        count = 0;
    }

    for(unsigned i = 0; i &lt; unique_words.size(); ++i)
    {
        std::cout &lt;&lt; unique_words[i] &lt;&lt; "   " &lt;&lt; frequency[i] &lt;&lt; std::endl;
    }
    return 0;
}
You could cut your code in half if you used a map:

typedef   std::map&lt;std::string, unsigned int&gt; Map;

Map tMap;
while(std::cin &gt;&gt; word)
{
    // When accessing a map with `[]` If the value does not exist
    // it is created and initialized to zero.
    //
    // The plus plus then increments the stored value
    tMap[word]++;
}

// Iterate through map and print frequency


Couple other notes from the code you have:


After unique_words.push_back(words[0]); you can start the i loop at index 1 instead of 0.
When checking for uniqueness in the first pair of loops, once you determine uniqueness to be false you can stop looping for that word: while(j &lt; unique_words.size() &amp;&amp; isUnique) ...