Guest User

Untitled

a guest
Jan 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. // Brian Nguyen
  2. // Robotics
  3. #include <iostream>
  4. #include <string>
  5. #include <vector>
  6. using namespace std;
  7.  
  8. int main () {
  9. string s;
  10. getline(cin,s);
  11. vector<string>arr;
  12. while (!s.empty()) {
  13. string temp;
  14. unsigned int pos = s.find(' ');
  15.  
  16. if (pos==string::npos) {
  17. arr.push_back(s);
  18. s.clear();
  19. }
  20. else {
  21. temp = s.substr(0,pos);
  22. arr.push_back(temp);
  23. s.erase(0,pos+1);
  24. }
  25. }
  26. return 0;
  27.  
  28. }
Add Comment
Please, Sign In to add comment