fork(1) download
  1. #include<iostream>
  2. #include<string>
  3. using namespace std;
  4. int main()
  5. {
  6. string str="12345678910111213141516171819202122232425262728293";
  7. std::size_t sz = str.size();
  8. std::size_t i = 0;
  9.  
  10. if(sz % 8) {
  11. cout<<str.substr(i, sz % 8) << ' ' ;
  12. i += sz % 8;
  13. }
  14. while(i<str.length())
  15. {
  16. cout << str.substr(i,8) << ' ';
  17. i = i+8;
  18. }
  19. cout << endl;
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0s 3228KB
stdin
Standard input is empty
stdout
12 34567891 01112131 41516171 81920212 22324252 62728293