#include <bits/stdc++.h>
char A[2002][2002];
int n, m;
void f(int i, int j) {
  int x, y, s = 0;
  if (i < 1 || j < 1 || i == m || j == n) return;
  for (x = 0; x <= 1; x++)
    for (y = 0; y <= 1; y++) s += (A[i + x][y + j] == '*');
  if (s == 1) {
    for (x = 0; x <= 1; x++)
      for (y = 0; y <= 1; y++) A[i + x][y + j] = '.';
    for (x = -1; x <= 1; x++)
      for (y = -1; y <= 1; y++) f(i + x, j + y);
  }
}
int main() {
  int i, j;
  scanf("%d %d", &m, &n);
  for (i = 1; i <= m; i++) scanf("%s", A[i] + 1);
  for (i = 1; i <= m - 1; i++)
    for (j = 1; j <= n - 1; j++) f(i, j);
  for (i = 1; i <= m; i++) printf("%s\n", A[i] + 1);
}
