Storing words from an input stream into a vector
Minor inconsistency here:


#include&lt;string&gt;



Add a space in between them, like all the others:

#include &lt;string&gt;

Just get rid of this:


using std::cout; using std::cin; using std::vector; using std::sort; using std::string; using std::endl; using std::domain_error; using std::cerr;



Even if you put them onto separate lines, it'll still be lengthy.  Just put std:: where necessary and try to keep it consistent.
Exception objects usually should not be passed by value:


catch (domain_error e)



They should be passed by const&amp;:

catch (domain_error const&amp; e)

Consider separating this into additional lines:


if (v.size() == 0) throw domain_error("Nothing to count");



While it's okay to put short statements on a single line, it may be a little harder to read and maintain longer lines, also with the lack of curly braces.

In addition, just call empty() instead of comparing size() to 0.

if (v.empty())
{
    throw domain_error("Nothing to count");
}

Instead of getting the first element via []:


string unique = v[0];



use front():

string unique = v.front();



I'd also like to add a compliment:

Thank you for using std::size_type instead of int.  I hardly see that done by others.  It's good to see that you're paying attention to return types and compiler mismatch warnings.