#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int xx[4] = {0, 0, 1, -1}, yy[4] = {1, -1, 0, 0};
int n, m;
char a[2005][2005];
void dfs(int x, int y) {
  if (x < 1 || y < 1 || x == n || y == m) return;
  int t = 0;
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++)
      if (a[i + x][j + y] == '*') t++;
  if (t == 1) {
    for (int i = 0; i < 2; i++)
      for (int j = 0; j < 2; j++) a[i + x][j + y] = '.';
    for (int i = -1; i < 2; i++)
      for (int j = -1; j < 2; j++) dfs(i + x, j + y);
  }
}
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= n; i++) scanf("%s", a[i] + 1);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) dfs(i, j);
  for (int i = 1; i <= n; i++) printf("%s\n", a[i] + 1);
  return 0;
}
