#include <vector> #include <iostream> #include <queue> #include <algorithm> #include <sstream> #include <vector> using namespace std; int main() { int n; while (cin >> n) { if(n==0) break; cin.ignore(); string s, t; vector<string> v; vector<vector<string>> vv; while (n--) { getline(cin, s); v.push_back(s); } //以上处理输入 //先排序 sort(v.begin(), v.end()); vector <string> temp; //将输入数据存入二维数组vv for (int i = 0; i < v.size(); i++) { stringstream ss(v[i]); // cout<<v[i]; temp.clear(); while (getline(ss, t, '\\')) { // cout<<t<<" "; if(!t.empty()) temp.push_back(t); } vv.push_back(temp); } vector<string> bz(vv[0]); for (int i = 0; i < vv.size(); i++) { for (int j = 0; j < vv[i].size(); j++) { if(j==0)//找到第一个不同的 while(vv[i]!=bz&&j<vv[i].size()&&j<bz.size()&&vv[i][j]==bz[j]) j++; if(j==vv[i].size()) break; if(vv[i][0]!=bz[0]) bz=vv[i];//如果第一个就不同,标准更新 for (int k = 0; k < j; k++) { cout << " "; } cout << vv[i][j] << endl; } } cout<<endl; } } // 64 位输出请用 printf("%lld")