Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <iterator>
  5. #include <string>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. string s,f="";
  11. int c=0;
  12. auto m=s.begin();
  13. auto r=find(m,s.end(),' ');
  14. vector <string> a;
  15. getline(cin,s);
  16. while(r!=s.end()){
  17. f=s.substr(c,find(m,s.end(),' ')-s.begin());
  18. m=m - s.begin() + find(m,s.end(),' ') + 1;
  19. c=m-s.begin();
  20. a.push_back(f);
  21. cout<<f<<" ";
  22. r=find(m,s.end(),' ');
  23. f="";
  24. }
  25. for(auto x:a){
  26. cout<<x;
  27. }
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement