#include <bits/stdc++.h>
using namespace std;
char s[2005][2005];
int n, m;
void change(int x, int y) {
  if (x < 0 || x >= n - 1 || y < 0 || y >= m - 1) {
    return;
  }
  int cnt = 0;
  int posx, posy;
  for (int i = 0; i < 2; ++i) {
    for (int j = 0; j < 2; ++j) {
      if (s[x + i][y + j] == '*') {
        ++cnt;
        posx = x + i;
        posy = y + j;
      }
    }
  }
  if (cnt == 1) {
    s[posx][posy] = '.';
    for (int i = -1; i < 2; ++i) {
      for (int j = -1; j < 2; ++j) {
        change(x + i, y + j);
      }
    }
  }
}
int main() {
  while (cin >> n >> m) {
    for (int i = 0; i < n; ++i) {
      scanf("%s", s[i]);
    }
    for (int i = 0; i < n - 1; ++i) {
      for (int j = 0; j < m - 1; ++j) {
        change(i, j);
      }
    }
    for (int i = 0; i < n; ++i) {
      printf("%s\n", s[i]);
    }
  }
  return 0;
}
