Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- #include <iterator>
- #include <string>
- using namespace std;
- int main()
- {
- string s,f="";
- int c=0;
- auto m=s.begin();
- auto r=find(m,s.end(),' ');
- vector <string> a;
- getline(cin,s);
- while(r!=s.end()){
- f=s.substr(c,find(m,s.end(),' ')-s.begin());
- m=m - s.begin() + find(m,s.end(),' ') + 1;
- c=m-s.begin();
- a.push_back(f);
- cout<<f<<" ";
- r=find(m,s.end(),' ');
- f="";
- }
- for(auto x:a){
- cout<<x;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement