#include<bits/stdc++.h>
#define fi first
#define se second
#define show(x) cerr<<#x<<"="<<x<<"\n"
typedef long long ll;
using namespace std;
const int dy[]={1,0,-1};
const int dx[]={1,0,-1};
int n,m,h,w;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.precision(10);
cout<<fixed;
#ifdef LOCAL_DEFINE
FILE *stream1;
stream1=freopen("in","r",stdin);
if(stream1==NULL)return 0;
#endif
while(cin>>n,n){
vector<string> s(n);
for(int i=0;i<n;i++){
cin>>s[i];
if(i==0)continue;
int j;
for(j=0;s[i][j+1]=='.';j++);
s[i][j]='+';
for(int k=i-1;k>0;k--){
if(s[k][j]=='.')s[k][j]='|';
else break;
}
}
for(int i=0;i<n;i++){
for(int j=0;j<(int)s[i].size();j++){
if(s[i][j]=='.')s[i][j]=' ';
}
cout<<s[i]<<endl;
}
}
#ifdef LOCAL_DEFINE
cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
fclose(stream1);
#endif
return 0;
}
- 日本語や読めてなくてかなり時間がかかってしまった。。。