#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <iterator>
std::vector<std::string> tokenize( std::string keyw )
{
const std::string delims = ",.:;_\n\r\t*-=()" ;
// replace each delimiter with a space
for( char& c : keyw ) if( delims.find(c) != std::string::npos ) c = ' ' ;
// construct an input stream which reads from the string
std::istringstream stm(keyw) ;
// read whitespace seperated tokens from the stream into a vector and return it
return { std::istream_iterator<std::string>(stm),
std::istream_iterator<std::string>() } ;
}
int main()
{
for( const auto& s : tokenize( "./client --search hello sick papa dont " ) )
std::cout << s << '\n' ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8c3N0cmVhbT4KI2luY2x1ZGUgPGl0ZXJhdG9yPgoKc3RkOjp2ZWN0b3I8c3RkOjpzdHJpbmc+IHRva2VuaXplKCBzdGQ6OnN0cmluZyBrZXl3ICkKewogICAgY29uc3Qgc3RkOjpzdHJpbmcgZGVsaW1zID0gIiwuOjtfXG5cclx0Ki09KCkiIDsKCiAgICAvLyByZXBsYWNlIGVhY2ggZGVsaW1pdGVyIHdpdGggYSBzcGFjZQogICAgZm9yKCBjaGFyJiBjIDoga2V5dyApIGlmKCBkZWxpbXMuZmluZChjKSAhPSBzdGQ6OnN0cmluZzo6bnBvcyApIGMgPSAnICcgOwoKICAgIC8vIGNvbnN0cnVjdCBhbiBpbnB1dCBzdHJlYW0gd2hpY2ggcmVhZHMgZnJvbSB0aGUgc3RyaW5nCiAgICBzdGQ6OmlzdHJpbmdzdHJlYW0gc3RtKGtleXcpIDsKCiAgICAvLyByZWFkIHdoaXRlc3BhY2Ugc2VwZXJhdGVkIHRva2VucyBmcm9tIHRoZSBzdHJlYW0gaW50byBhIHZlY3RvciBhbmQgcmV0dXJuIGl0CiAgICByZXR1cm4geyBzdGQ6OmlzdHJlYW1faXRlcmF0b3I8c3RkOjpzdHJpbmc+KHN0bSksCiAgICAgICAgICAgICAgc3RkOjppc3RyZWFtX2l0ZXJhdG9yPHN0ZDo6c3RyaW5nPigpIH0gOwp9CgppbnQgbWFpbigpCnsKICAgIGZvciggY29uc3QgYXV0byYgcyA6IHRva2VuaXplKCAiLi9jbGllbnQgLS1zZWFyY2ggaGVsbG8gc2ljayBwYXBhIGRvbnQgIiApICkKICAgICAgICBzdGQ6OmNvdXQgPDwgcyA8PCAnXG4nIDsKfQo=