fork download
  1. #include <vector>
  2. #include <string>
  3. #include <iostream>
  4.  
  5. using std::vector;
  6. using std::string;
  7. using std::cout;
  8. using std::cin;
  9. using std::endl;
  10.  
  11. int main()
  12. {
  13. string s1 = "AreYouOK";
  14. vector<string> v;
  15.  
  16. string::const_iterator b = s1.begin();
  17. for (string::const_iterator iter = b;
  18. iter != s1.end()-1; ++iter)
  19. {
  20. string s(b,iter);
  21. s += *iter;
  22. v.push_back(s);
  23. }
  24.  
  25. for (vector<string>::const_iterator iter = v.begin();
  26. iter != v.end(); ++iter)
  27. {
  28. cout << *iter <<endl;
  29. }
  30.  
  31. return 0;
  32. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
A
Ar
Are
AreY
AreYo
AreYou
AreYouO