#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, k, p, x, y, a, b;
char A[2001][2001];
queue<pair<int, int> > Q;
pair<int, int> R[4000001];
int ox[] = {-1, -1, 0, 0};
int oy[] = {-1, 0, -1, 0};
int P[2001][2001];
int asterisks(int i, int j) {
  return (A[i][j] == '*') + (A[i][j + 1] == '*') + (A[i + 1][j] == '*') +
         (A[i + 1][j + 1] == '*');
}
int main() {
  scanf("%d%d", &n, &m);
  for (i = 0; i < n; i++) scanf("%s", A[i]);
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++)
      if (A[i][j] == '*') {
        for (k = 0; k < 4; k++) {
          x = i + ox[k];
          y = j + oy[k];
          if (x >= 0 && y >= 0 && x + 1 < n && y + 1 < m &&
              asterisks(x, y) == 1)
            break;
        }
        if (k < 4) A[i][j] = '.';
      }
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++)
      if (A[i][j] == '*') {
        for (k = 0; k < 4; k++) {
          x = i + ox[k];
          y = j + oy[k];
          if (x >= 0 && y >= 0 && x + 1 < n && y + 1 < m &&
              asterisks(x, y) == 1)
            break;
        }
        if (k < 4) {
          R[b++] = make_pair(i, j);
          P[i][j] = 1;
        }
      }
  while (a < b) {
    i = R[a].first;
    j = R[a].second;
    a++;
    A[i][j] = '.';
    for (k = 0; k < 4; k++) {
      x = i + ox[k];
      y = j + oy[k];
      if (x >= 0 && y >= 0 && x + 1 < n && y + 1 < m && asterisks(x, y) == 1) {
        for (p = 0; p < 4 && A[x - ox[p]][y - oy[p]] == '.'; p++)
          ;
        if (!P[x - ox[p]][y - oy[p]]) {
          R[b++] = make_pair(x - ox[p], y - oy[p]);
          P[x - ox[p]][y - oy[p]] = 1;
        }
      }
    }
  }
  for (i = 0; i < n; i++) printf("%s\n", A[i]);
  return 0;
}
