stringstream is a class in C++ that allows strings to be processed as streams, which means that familiar stream input, output statements can be used to read from or write to them.
example
#include <string>
#include <sstream>
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
string str="aaa bbb ccc ddd";
stringstream s(str);
string word;
while(s>>word){
cout<<word<<endl;
}
return 0;
}