#include using namespace std; using ll = long long; template istream& operator >> (istream& is, vector& vec) { for(T& x : vec) is >> x; return is; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int h, w; cin >> h >> w; vector A(h); cin >> A; vector Xc(w), Yc(h); for(int y = 0; y < h; y++){ for(int x = 0; x < w; x++){ Xc[x] += A[y][x] == '#'; } } for(int y = 0; y < h; y++){ for(int x = 0; x < w; x++){ Yc[y] += Xc[x] >= y + 1; } } for(int y = 0; y < h; y++){ for(int x = 0; x < w; x++){ cout << (x < Yc[y] ? '#' : '.'); } cout << '\n'; } }