#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<char>> a(N + 2, vector<char>(M + 2, '*'));
  for (int i = 1; i < N + 1; ++i) {
    scanf("\n");
    for (int j = 1; j < M + 1; ++j) {
      scanf("%c", &a[i][j]);
    }
  }
  auto get_int = [&](int i, int j) -> int { return (a[i][j] == '*' ? 1 : 0); };
  auto check_rect = [&](int i, int j) -> bool {
    return (get_int(i, j) + get_int(i + 1, j) + get_int(i, j + 1) +
                get_int(i + 1, j + 1) ==
            1);
  };
  queue<pair<int, int>> sq;
  for (int i = 0; i < N + 1; ++i) {
    for (int j = 0; j < M + 1; ++j) {
      if (check_rect(i, j)) {
        sq.push(make_pair(i, j));
      }
    }
  }
  std::array<pair<int, int>, 8> moves{{make_pair(-1, -1), make_pair(-1, +0),
                                       make_pair(-1, +1), make_pair(+0, -1),
                                       make_pair(+0, +1), make_pair(+1, -1),
                                       make_pair(+1, +0), make_pair(+1, +1)}};
  while (!sq.empty()) {
    auto p = sq.front();
    sq.pop();
    if (!check_rect(p.first, p.second)) {
      continue;
    }
    a[p.first][p.second] = '.';
    a[p.first + 1][p.second] = '.';
    a[p.first][p.second + 1] = '.';
    a[p.first + 1][p.second + 1] = '.';
    for (const auto &mv : moves) {
      if (check_rect(p.first + mv.first, p.second + mv.second)) {
        sq.push(make_pair(p.first + mv.first, p.second + mv.second));
      }
    }
  }
  for (int i = 1; i < N + 1; ++i) {
    for (int j = 1; j < M + 1; ++j) {
      printf("%c", a[i][j]);
    }
    printf("\n");
  }
  return 0;
}
