#include <bits/stdc++.h>
using namespace std;
int n, m, tot = 0;
char s[2010][2010];
bool in(int x, int y) { return 1 <= x && x <= n && 1 <= y && y <= m; }
bool check(int x, int y) {
  bool fl = false;
  if (in(x - 1, y - 1))
    fl |= (s[x - 1][y - 1] == '.' && s[x - 1][y] == '.' && s[x][y - 1] == '.');
  if (in(x + 1, y - 1))
    fl |= (s[x + 1][y - 1] == '.' && s[x][y - 1] == '.' && s[x + 1][y] == '.');
  if (in(x - 1, y + 1))
    fl |= (s[x - 1][y + 1] == '.' && s[x - 1][y] == '.' && s[x][y + 1] == '.');
  if (in(x + 1, y + 1))
    fl |= (s[x + 1][y + 1] == '.' && s[x + 1][y] == '.' && s[x][y + 1] == '.');
  return fl;
}
int dir[8][2] = {{1, 0}, {-1, 0},  {0, 1},  {0, -1},
                 {1, 1}, {-1, -1}, {-1, 1}, {1, -1}};
bool vis[2010][2010];
struct node {
  int x, y;
  node() {}
  node(int xx, int yy) {
    x = xx;
    y = yy;
  }
};
queue<node> q;
int main() {
  scanf("%d%d", &n, &m);
  for (register int i = 1; i <= n; i++) {
    for (register int j = 1; j <= m; j++) {
      scanf(" %c", &s[i][j]);
      if (s[i][j] == '*') {
        vis[i][j] = true;
        q.push(node(i, j));
      }
    }
  }
  while (!q.empty()) {
    node fuck = q.front();
    q.pop();
    vis[fuck.x][fuck.y] = false;
    if (check(fuck.x, fuck.y)) {
      s[fuck.x][fuck.y] = '.';
      for (register int i = 0; i < 8; i++) {
        int tx = fuck.x + dir[i][0];
        int ty = fuck.y + dir[i][1];
        if (in(tx, ty) && s[tx][ty] == '*' && !vis[tx][ty]) {
          vis[tx][ty] = true;
          q.push(node(tx, ty));
        }
      }
    }
  }
  for (register int i = 1; i <= n; i++) {
    for (register int j = 1; j <= m; j++) {
      printf("%c", s[i][j]);
    }
    printf("\n");
  }
  return 0;
}
