fork download
  1. #include <algorithm>
  2. #include <cstring>
  3. #include <iostream>
  4. #include <iterator>
  5. #include <string>
  6. #include <vector>
  7.  
  8. using namespace std;
  9.  
  10. int main() {
  11. auto str = "The quick brown fox"s;
  12. vector<string> tokens;
  13.  
  14. for (auto i = strtok(&str[0], " "); i != nullptr; i = strtok(nullptr, " ")) tokens.push_back(i);
  15.  
  16. copy(cbegin(tokens), cend(tokens), ostream_iterator<string>(cout, "\n"));
  17. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
The
quick
brown
fox