#include <bits/stdc++.h>
using namespace std;
int i, j, k, l, n, m, a[2015][2015], dx, dy, sm, dj;
string s[2015];
queue<pair<int, int> > q;
void wh(int i, int j) {
  int dx = 0, dy = 0;
  if (a[i][j] == 1) {
    dx = i;
    dy = j;
  } else if (a[i][j + 1] == 1) {
    dx = i;
    dy = j + 1;
  } else if (a[i + 1][j + 1] == 1) {
    dx = i + 1;
    dy = j + 1;
  } else if (a[i + 1][j] == 1) {
    dx = i + 1;
    dy = j;
  }
  a[dx][dy] = 0;
  q.push(make_pair(dx, dy));
}
void sum(int i, int j) {
  if (i < 1 || j < 1 || i >= n || j >= m) return;
  int sm = a[i][j] + a[i][j + 1] + a[i + 1][j] + a[i + 1][j + 1];
  if (sm == 1) wh(i, j);
}
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    cin >> s[i];
    for (j = 1; j <= m; j++)
      if (s[i][j - 1] == '*') a[i][j] = 1;
  }
  for (i = 1; i < n; i++) {
    for (j = 1; j < m; j++) {
      sm = a[i][j] + a[i][j + 1] + a[i + 1][j] + a[i + 1][j + 1];
      if (sm == 1) {
        if (a[i][j] == 1) {
          dx = i;
          dy = j;
        } else if (a[i][j + 1] == 1) {
          dx = i;
          dy = j + 1;
        } else if (a[i + 1][j + 1] == 1) {
          dx = i + 1;
          dy = j + 1;
        } else if (a[i + 1][j] == 1) {
          dx = i + 1;
          dy = j;
        }
        a[dx][dy] = 0;
        q.push(make_pair(dx, dy));
      }
    }
  }
  while (!q.empty()) {
    dx = q.front().first;
    dj = q.front().second;
    q.pop();
    sum(dx, dj);
    sum(dx, dj + 1);
    sum(dx, dj - 1);
    sum(dx + 1, dj - 1);
    sum(dx + 1, dj);
    sum(dx + 1, dj + 1);
    sum(dx - 1, dj - 1);
    sum(dx - 1, dj);
    sum(dx - 1, dj + 1);
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      if (a[i][j] == 0)
        printf(".");
      else
        printf("*");
    }
    printf("\n");
  }
}
