#include <bits/stdc++.h>
using namespace std;
template <class T>
void read(T& num) {
  char CH;
  bool F = false;
  for (CH = getchar(); CH < '0' || CH > '9'; F = CH == '-', CH = getchar())
    ;
  for (num = 0; CH >= '0' && CH <= '9';
       num = num * 10 + CH - '0', CH = getchar())
    ;
  F && (num = -num);
}
const int N = 2222;
int n, m;
char s[N][N];
void dfs(int x, int y) {
  if (x < 0 || x >= n - 1 || y < 0 || y >= m - 1) return;
  int sum = 0, tx, ty;
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      if (s[x + i][y + j] == '*') {
        sum++;
        tx = x + i;
        ty = y + j;
      }
    }
  }
  if (sum == 1) {
    s[tx][ty] = '.';
    for (int i = -1; i <= 1; i++)
      for (int j = -1; j <= 1; j++) dfs(tx + i, ty + j);
  }
}
int main() {
  read(n);
  read(m);
  for (int i = 0; i < n; i++) scanf("%s", s[i]);
  for (int i = 0; i < n - 1; i++) {
    for (int j = 0; j < m - 1; j++) {
      dfs(i, j);
    }
  }
  for (int i = 0; i < n; i++) puts(s[i]);
  return 0;
}
