stringstream
1 #include <iostream> 2 #include <sstream> 3 4 using namespace std; 5 6 int main(int argc, char **argv) 7 { 8 string line; 9 while (getline(cin, line)) 10 { 11 cout << line << endl; 12 string val; 13 istringstream iss(line); 14 while (iss >> val) 15 { 16 cout << " " << val << endl; 17 } 18 } 19 return 0; 20 }