fork download
  1. #include <vector>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. int main(int argc, const char * argv[])
  8. {
  9. vector<int> v;
  10.  
  11. for(int a; cin >> a ; )
  12. {
  13. if (a == -1) break;
  14. v.push_back(a);
  15. }
  16.  
  17. vector<vector<int>> res(v.size()/6);
  18.  
  19. for(int i = 0; i < v.size(); i++)
  20. {
  21. res[i/6].push_back(v[i]);
  22. }
  23.  
  24. for(auto& w: res)
  25. {
  26. for(auto i: w) cout << i << " "; cout << endl;
  27. }
  28. }
  29.  
Success #stdin #stdout 0s 15240KB
stdin
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 -1
stdout
1 2 3 4 5 6 
7 8 9 10 11 12 
13 14 15 16 17 18