#include <bits/stdc++.h>
int i, j, k, s, n, m, h, matrix[3000][3000];
inline int solve(int i, int j) {
  if (i < 0 || i >= n || j < 0 || j >= m) return 0;
  int x, y;
  int s = 0;
  for (x = 0; x <= 1; x++)
    for (y = 0; y <= 1; y++)
      s += (matrix[x + i - (x + i >= n)][y + j - (y + j >= m)] == '*');
  if (s == 1) {
    for (x = 0; x <= 1; x++)
      for (y = 0; y <= 1; y++) matrix[x + i][y + j] = '.';
    for (x = -1; x <= 1; x++)
      for (y = -1; y <= 1; y++) solve(x + i, y + j);
    return 1;
  }
  return 0;
}
int main() {
  char c;
  scanf("%d %d", &n, &m);
  for (i = 0; i <= n - 1; i++)
    for (j = 0; j <= m - 1; j++) {
      scanf(" %c", &c);
      matrix[i][j] = c;
    }
  int f;
  for (i = 0; i <= n - 2; i++) {
    for (j = 0; j <= m - 2; j++) {
      solve(i, j);
    }
  }
  for (i = 0; i <= n - 1; i++) {
    for (j = 0; j <= m - 1; j++) printf("%c", matrix[i][j]);
    puts("");
  }
  return 0;
}
