fork(1) download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. vector<string> split(string s) {
  6. char letter;
  7. vector<string> vector_string;
  8.  
  9. for(int i=0; i<s.length(); ) {
  10. if (isalnum(s[i])) {
  11. string r;
  12. do {
  13. r.push_back(s[i++]);
  14. } while(i<s.length() && isalnum(s[i]));
  15. vector_string.push_back(r);
  16. }
  17. else i++;
  18. }
  19. return vector_string;
  20. }
  21.  
  22. int main() {
  23. auto str=";This.;/Is.a.String";
  24. auto res = split (str);
  25. for (auto&x:res)
  26. cout<< x<<endl;
  27. return 0;
  28. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
This
Is
a
String