fork(1) download
  1. #include<cstdio>
  2. #include<cstring>
  3. #include<vector>
  4. #include<cstdlib>
  5. #include<sstream>
  6. #include<iostream>
  7.  
  8. using namespace std;
  9.  
  10. vector<int> val[10010];
  11.  
  12. int main(){
  13.  
  14. int n,i,j,temp;
  15. stringstream stream;
  16. string s;
  17. scanf("%d",&n);
  18. vector<int>::iterator it;
  19.  
  20. for(i=0;i<n;i++){
  21.  
  22. getline(cin,s);
  23. stream.clear();
  24. stream.str(s);
  25.  
  26.  
  27. while(1) {
  28. stream >> temp;
  29. val[i].push_back(temp);
  30.  
  31. if(!stream)
  32. break;
  33. }
  34.  
  35. for(it=val[i].begin();it!=val[i].end();it++)
  36. printf("%d ",*it);
  37.  
  38. printf("\n");
  39. }
  40. return 0;}
Success #stdin #stdout 0s 3552KB
stdin
4
1 2
3 4
5 6
7 8
stdout
0 
1 2 2 
3 4 4 
5 6 6