fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. string str;
  9. while(getline(cin,str)) {
  10. stringstream ss(str);
  11. string line;
  12. while(getline(ss,line,',')) {
  13. cout << line << endl;
  14. }
  15. cout << endl;
  16. }
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 3464KB
stdin
1,2,3
4,5,6
7,8,9,0
stdout
1
2
3

4
5
6

7
8
9
0