#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi acos(-1.0)
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main(){
	int n;
	while (cin >> n && n){
		vector<string> s(n);
		REP(i,n) cin >> s[i];
		FOR(i,1,n-1){
			int x = 0;
			while (s[i][x] == '.'){
				s[i][x] = ' ';
				x++;
			}
			s[i][x-1] = '+';
		}
		REP(i,n) REP(j,s[i].length()){
			if (s[i][j] == '+'){
				int x = i-1;
				while (s[x][j] == ' '){
					s[x][j] = '|';
					x--;
				}
			}
		}
		REP(i,n) cout << s[i] << endl;
	}
    return 0;
}