#include <bits/stdc++.h>
using namespace std;
int a[3001][3001], n, m;
void dfs(int x, int y) {
  if (x < 1 || y < 1 || x > n || y > m) return;
  int d = 0;
  for (int i = -1; i <= 0; ++i) {
    for (int j = -1; j <= 0; ++j) {
      if (x + i < 1 || y + j < 1)
        return;
      else if (a[x + i][y + j] == 0) {
        ++d;
      }
    }
  }
  if (d != 3) return;
  for (int i = -1; i <= 0; ++i) {
    for (int j = -1; j <= 0; ++j) {
      a[x + i][y + j] = 0;
    }
  }
  for (int i = -1; i <= 1; ++i) {
    for (int j = -1; j <= 1; ++j) {
      dfs(x + i, y + j);
    }
  }
}
int main() {
  if (fopen("test.inp", "r")) {
    freopen("test.inp", "r", stdin);
  }
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      char c;
      cin >> c;
      a[i][j] = (c == '*');
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      dfs(i, j);
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (a[i][j] == 0) {
        cout << ".";
      } else {
        cout << "*";
      }
    }
    cout << "\n";
  }
}
