#include <bits/stdc++.h>
using namespace std;
const inline int __GET_INT() {
  int ret;
  scanf("%d", &ret);
  return ret;
}
const int maxn = 2002;
int n, m;
char grid[maxn][maxn];
int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1};
int cntStar(int r, int c) {
  return (grid[r][c] == '*') + (grid[r + 1][c] == '*') +
         (grid[r][c + 1] == '*') + (grid[r + 1][c + 1] == '*');
}
void dfs(int r, int c) {
  if (r < 0 || c < 0 || (r + 1) >= n || (c + 1) >= m) {
    return;
  }
  if (cntStar(r, c) != 1) {
    return;
  }
  grid[r][c] = grid[r + 1][c] = grid[r][c + 1] = grid[r + 1][c + 1] = '.';
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < 2; ++j) {
      for (int k = 0; k < 8; ++k) {
        dfs(r + i + dx[k], c + j + dy[k]);
      }
    }
}
int main() {
  n = __GET_INT();
  m = __GET_INT();
  for (int i = 0; i < n; ++i) {
    scanf("%s", grid[i]);
  }
  for (int i = 0; (i + 1) < n; ++i)
    for (int j = 0; (j + 1) < m; ++j) {
      dfs(i, j);
    }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) printf("%c", grid[i][j]);
    puts("");
  }
  return 0;
}
