Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Brian Nguyen
- // Robotics
- #include <iostream>
- #include <string>
- #include <vector>
- using namespace std;
- int main () {
- string s;
- getline(cin,s);
- vector<string>arr;
- while (!s.empty()) {
- string temp;
- unsigned int pos = s.find(' ');
- if (pos==string::npos) {
- arr.push_back(s);
- s.clear();
- }
- else {
- temp = s.substr(0,pos);
- arr.push_back(temp);
- s.erase(0,pos+1);
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment