#define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define MAX_MOD 1000000007 #define REP(i,n) for(long long i = 0;i < n;++i) #define LONG_INF 100000000000000 int cheat[1000][1000] = {}; int main() { iostream::sync_with_stdio(false); int h, w; cin >> h >> w; vector wow; REP(i, h) { string a; cin >> a; wow.push_back(a); for (int q = 0;q < w;++q) { if (wow[i][q] == '*') { for (int j = 0;j < h;++j) { cheat[j][q]++; } for (int j = 0;j < w;++j) { cheat[i][j]++; } } } } for (int i = 0;i < h;++i) { for (int q = 0;q < w;++q) { if (cheat[i][q] == 1) { wow[i][q] = '*'; goto ok; } } } ok:; REP(i, h) { cout << wow[i] << endl; } return 0; }