#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2010;
char v[MAXN][MAXN];
int n, m;
int dx[] = {0, 0, 1, 1};
int dy[] = {0, 1, 0, 1};
bool visi[MAXN][MAXN];
void check(int x, int y) {
  if (x >= n - 1 || x < 0 || y >= m - 1 || y < 0 || visi[x][y]) return;
  int c = 0;
  for (int i = 0; i < (4); ++i) {
    int nx = x + dx[i];
    int ny = y + dy[i];
    c += (nx >= 0 && nx < n && ny >= 0 && ny < m && v[nx][ny] == '*');
  }
  if (c == 1) {
    for (int i = 0; i < (4); ++i) {
      int nx = x + dx[i];
      int ny = y + dy[i];
      v[nx][ny] = '.';
    }
    visi[x][y] = true;
    for (int dx = -1; dx < (2); ++dx)
      for (int dy = -1; dy < (2); ++dy) check(x + dx, y + dy);
  }
}
int main() {
  ios::sync_with_stdio(false);
  while (cin >> n >> m) {
    for (int i = 0; i < (n); ++i)
      for (int j = 0; j < (m); ++j) {
        cin >> v[i][j];
      }
    memset(visi, 0, sizeof(visi));
    for (int i = 0; i < (n); ++i)
      for (int j = 0; j < (m); ++j) check(i, j);
    for (int i = 0; i < (n); ++i) {
      for (int j = 0; j < (m); ++j) cout << v[i][j];
      cout << "\n";
    }
  }
  return 0;
}
