#include #include #include /* Copyright (C) 1992,2000 Bisqwit (http://iki.fi/bisqwit/) */ static class dir { map dirs; set files; public: void add(const string &s) { unsigned r = s.find('/'); if(r == s.npos) files.insert(s); else dirs[s.substr(0, r)].add(s.substr(r+1)); } void print(const string &pref, const char *post) const { set::const_iterator i; for(i=files.begin(); i!=files.end(); ++i) if(dirs.find(*i) == dirs.end()) cout << pref << *i << post << endl; map::const_iterator j; for(j=dirs.begin(); j!=dirs.end(); ++j)cout << pref << j->first << post << endl; for(j=dirs.begin(); j!=dirs.end(); ++j)j->second.print(pref + j->first + '/', post); } } root; int main() { while(cin.good()) { string s; getline(cin, s); root.add(s); } root.print("", ""); return 0; }