#include <bits/stdc++.h>
using namespace std;
const int MAX = 2020;
char all[MAX][MAX];
bool safe[MAX][MAX];
int n, m;
int dx[8] = {0, -1, -1, -1, 0, 1, 1, 1};
int dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int ma(int x, int y) {
  int an = 0;
  for (int i = 0; i < 8; i += 2) {
    int tmp = 0;
    for (int j = 0; j < 3; ++j) {
      tmp += (all[x + dx[(i + j) % 8]][y + dy[(i + j) % 8]] == '.');
    }
    an = max(an, tmp);
  }
  return an;
}
int main(int argc, char const *argv[]) {
  memset(all, '*', sizeof all);
  memset(safe, 1, sizeof safe);
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    char si[m];
    scanf("%s", si);
    for (int j = 1; j <= m; ++j) all[i][j] = si[j - 1];
  }
  queue<pair<int, int> > bf;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      safe[i][j] = 0;
      if (all[i][j] == '*' && ma(i, j) == 3)
        bf.push(make_pair(i, j)), safe[i][j] = 1;
    }
  }
  while (!bf.empty()) {
    pair<int, int> s = bf.front();
    bf.pop();
    int x = s.first, y = s.second;
    all[x][y] = '.';
    for (int i = 0; i < 8; ++i) {
      if (safe[x + dx[i]][y + dy[i]]) continue;
      if (all[x + dx[i]][y + dy[i]] == '*' && ma(x + dx[i], y + dy[i]) == 3) {
        bf.push(make_pair(x + dx[i], y + dy[i]));
        safe[x + dx[i]][y + dy[i]] = 1;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      printf("%c", all[i][j]);
    }
    printf("\n");
  }
  return 0;
}
