This is the simplest way, which I used a lot. It works for any one-character delimiter.
#include
using namespace std;
int main() {
string str;
cin >> str;
int temp;
vector result;
char ch;
stringstream ss(str);
do
{
ss>>temp;
result.push_back(temp);
}while(ss>>ch);
for(int i=0 ; i < result.size() ; i++)
cout<