Here is a boost solution just for the fun of it. It will remove the string you don't want and treat successive delimiters as one. if you do not have C++11, replace the lambda with a pointer to your own function :
#include <boost/algorithm/string/find_iterator.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string.hpp>
using namespace std;
int main(int argc, char** argv)
{
const string delim{' '};
vector<string> splitVec;
string inStr = "keep all this but remove THAT if you see it";
boost::split( splitVec, inStr, boost::algorithm::is_any_of(&delim[0]), boost::token_compress_on );
copy_if(splitVec.begin(),splitVec.end(), ostream_iterator<string>(cout," "), [](const string& argStr) -> bool { return(argStr != "THAT"); } );
}
Gives:
keep all this but remove if you see it