| 93 | } |
| 94 | |
| 95 | vector<string> split(const string &str) { |
| 96 | vector<string> tokens; |
| 97 | |
| 98 | string::size_type start = 0; |
| 99 | string::size_type end = 0; |
| 100 | |
| 101 | while ((end = str.find(" ", start)) != string::npos) { |
| 102 | tokens.push_back(str.substr(start, end - start)); |
| 103 | |
| 104 | start = end + 1; |
| 105 | } |
| 106 | |
| 107 | tokens.push_back(str.substr(start)); |
| 108 | |
| 109 | return tokens; |
| 110 | } |