赵倪峻1
(赵倪峻)
1
#include<bits/stdc++.h>
using namespace std;
map<string,set<string> >tree;
int n,op[55];
string start;
void dfs(string u,int dep)
{
for (int st=1;st<=dep;st++)
{
if (st==1) printf("|");
else printf(" |");
}
if (u!=start)
{
printf("----");
}
cout<<u<<endl;
for (map<string,set<string> >::iterator it=tree.begin();it!=tree.end();it++)
{
if (it->first==u)
{
for (set<string>::iterator it2=it->second.begin();it2!=it->second.end();it2++)
{
dfs(*it2,dep+1);
}
}
}
}
int main()
{
scanf("%d",&n);
int fg=0;
for (int st=1;st<=n;st++)
{
string s;
cin>>s;
int tmp=0;
for (int i=0;i<s.size();i++)
{
if (s[i]=='/')
{
op[++tmp]=i;
}
}
op[0]=-1;
op[++tmp]=s.size();
for (int i=0;i<tmp-1;i++)
{
int l1=op[i]+1,r1=op[i+1]-1,l2=op[i+1]+1,r2=op[i+2]-1;
if (!fg)
{
start=s.substr(l1,r1-l1+1);
fg=1;
}
tree[s.substr(l1,r1-l1+1)].insert(s.substr(l2,r2-l2+1));
}
}
dfs(start,0);
return 0;
}