fork(1) download
  1. #include <set>
  2. #include <iostream>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. string mystring = "Hello World this is my string";
  10. string temp = "";
  11. set<string> myset;
  12.  
  13. for (unsigned int i = 0; i < mystring.length(); i++)
  14. {
  15. if (mystring.at(i) == ' ')
  16. {
  17. myset.insert(temp);
  18. temp = "";
  19. }
  20. else
  21. {
  22. temp.push_back(mystring.at(i));
  23. }
  24. }
  25. myset.insert(temp);
  26. return 0;
  27. }
Success #stdin #stdout 0.01s 2812KB
stdin
Standard input is empty
stdout
Standard output is empty