Advertisement
Guest User

Untitled

a guest
Oct 21st, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 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.         if(line == "a")
  24.             break;
  25.         vector<string> cur_nonempty = split(line);
  26.         cur_nonempty.pop_back();
  27.        
  28.         for(auto i = cur_nonempty.begin(); i != cur_nonempty.end(); i++)
  29.             nonempty.insert(*i);
  30.     }
  31.     while(!nonempty.empty())
  32.     {
  33.         cout << *nonempty.begin() << endl;
  34.         nonempty.erase(nonempty.begin());
  35.     }
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement