#include <bits/stdc++.h>
using namespace std;
const int maxn = 2005;
const int dir_x[4][3] = {{1, 0, 1}, {0, -1, -1}, {-1, -1, 0}, {1, 1, 0}};
const int dir_y[4][3] = {{0, 1, 1}, {1, 0, 1}, {0, -1, -1}, {0, -1, -1}};
char mat[maxn][maxn];
int n, m;
void input() {
  for (int i = 0; i < n; i++) puts(mat[i]);
}
void bfs() {
  queue<pair<int, int> > q;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (mat[i][j] == '.') q.push(make_pair(i, j));
  while (!q.empty()) {
    pair<int, int> now = q.front();
    q.pop();
    int x = now.first, y = now.second;
    int pos_x, pos_y, cnt;
    for (int i = 0; i < 4; i++) {
      cnt = 0;
      int ok = 1;
      for (int j = 0; j < 3; j++) {
        int xx = x + dir_x[i][j];
        int yy = y + dir_y[i][j];
        if (xx >= 0 && xx < n && yy >= 0 && yy < m) {
          if (mat[xx][yy] == '*') {
            pos_x = xx;
            pos_y = yy;
            cnt++;
          }
        } else {
          ok = 0;
          break;
        }
      }
      if (ok && cnt == 1) {
        mat[pos_x][pos_y] = '.';
        q.push(make_pair(pos_x, pos_y));
      }
    }
  }
  return;
}
int main() {
  while (~scanf("%d%d", &n, &m)) {
    for (int i = 0; i < n; i++) scanf("%s", mat[i]);
    bfs();
    input();
  }
  return 0;
}
