fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. string s1 = "all good is good";
  8. int findRes;
  9.  
  10. findRes = s1.find(' ');
  11. while (findRes < s1.length()){
  12. s1.replace(findRes, 1, "/");
  13. findRes = s1.find(' ');
  14. cout << "findRes = " << findRes;
  15. cout << " s1 size = " << s1.size();
  16. cout << " findRes < s1.size() " << (findRes < s1.size()) << endl;
  17. }
  18. cout << s1.max_size();
  19. return 0;
  20. }
Success #stdin #stdout 0s 3272KB
stdin
Standard input is empty
stdout
findRes = 8 s1 size = 16 findRes < s1.size() 1
findRes = 11 s1 size = 16 findRes < s1.size() 1
findRes = -1 s1 size = 16 findRes < s1.size() 0
1073741820