Advertisement
Guest User

Untitled

a guest
Oct 21st, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #include <iostream>
  2. #include <set>
  3. #include <vector>
  4. using namespace std;
  5.  
  6. vector<string> split(const string& to_split)
  7. {
  8. vector<string> splitted(1);
  9. for(auto i = to_split.begin(); i != to_split.end(); i++)
  10. {
  11. splitted.back() += *i;
  12. if(*i == '/')
  13. splitted.push_back(splitted.back());
  14. }
  15. return splitted;
  16. }
  17.  
  18. int main() {
  19. set<string> nonempty;
  20. string line;
  21. while(cin >> line)
  22. {
  23. vector<string> cur_nonempty = split(line);
  24. cur_nonempty.pop_back();
  25.  
  26. for(auto i = cur_nonempty.begin(); i != cur_nonempty.end(); i++)
  27. nonempty.insert(*i);
  28. }
  29. while(!nonempty.empty())
  30. {
  31. cout << *nonempty.begin() << endl;
  32. nonempty.erase(nonempty.begin());
  33. }
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement