#include <bits/stdc++.h>
using namespace std;
double tick() {
  static clock_t oldt, newt = clock();
  double diff = 1.0 * (newt - oldt) / CLOCKS_PER_SEC;
  oldt = newt;
  return diff;
}
inline long long int read() {
  long long int f = 1, x = 0;
  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;
}
long long int fastExpo(long long int a, long long int n) {
  long long int res = 1;
  while (n) {
    if (n % 2) res = res * a;
    n /= 2;
    a = a * a;
  }
  return res;
}
int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1};
char a[2010][2010];
bool check(int x, int y) {
  if (a[x][y] != '*') return false;
  if (a[x - 1][y - 1] == '.' && a[x][y - 1] == '.' && a[x - 1][y] == '.')
    return true;
  if (a[x - 1][y] == '.' && a[x - 1][y + 1] == '.' && a[x][y + 1] == '.')
    return true;
  if (a[x][y + 1] == '.' && a[x + 1][y + 1] == '.' && a[x + 1][y] == '.')
    return true;
  if (a[x + 1][y] == '.' && a[x + 1][y - 1] == '.' && a[x][y - 1] == '.')
    return true;
  return false;
}
void dfs(int x, int y) {
  a[x][y] = '.';
  for (int i = 0; i < 8; i++) {
    if (check(x + dx[i], y + dy[i])) dfs(x + dx[i], y + dy[i]);
  }
}
int main() {
  int n = read(), m = read();
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cin >> a[i][j];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (check(i, j)) dfs(i, j);
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) putchar(a[i][j]);
    cout << endl;
  }
  cerr << "execution time is: " << tick() << "\n";
}
