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