#include <iostream>
#include <string>
int main()
{
std::string str = "c++ php;java,c python-c# c++ javascript go";
std::string const delimiters{ " .,-;" };
size_t index_start, pos = 0;
while ((index_start = str.find_first_not_of(delimiters, pos)) != std::string::npos) {
pos = str.find_first_of(delimiters, index_start + 1);
std::cout << str.substr(index_start, pos - index_start) << "\n";
}
}
/*
run:
c++
php
java
c
python
c#
c++
javascript
go
*/