Split a String On A Word By Words
I'm not overly fond of the tmp.push_back(std::string());.

I'd rather some of the names were clearer and more readable--for example, I'm not entirely sure what rescnt is supposed to mean.

Under the circumstances, I'd tend to wonder whether we're getting enough good out of the stringstream to justify its existence either. They can be handy, but here we don't seem to be putting the capabilities to a whole lot of use.

std::vector&lt;std::string&gt; split(std::string const &amp;in, std::string const &amp;word) {
    std::vector&lt;std::string&gt; ret;

    int begin = 0;
    int end = 0;

    while (std::string::npos != (end = in.find(word, begin))) {
        ret.push_back(in.substr(begin, end-begin));
        begin = end + word.length()+1;
        while (::isspace(in[begin]))
          ++begin;
    }
    ret.push_back(in.substr(begin));
    return ret;
}