#include <bits/stdc++.h>
using namespace std;
const int mx = 2e3 + 10;
char b[mx][mx];
int n, m;
bool rem(int i, int j) {
  if (b[i][j] == '.') return false;
  for (int r = i - 1; r <= i; r++)
    for (int c = j - 1; c <= j; c++) {
      if (r < 0 || c < 0) continue;
      if (r + 1 >= n || c + 1 >= m) continue;
      int cnt = 0;
      for (int dr = 0; dr < 2; dr++)
        for (int dc = 0; dc < 2; dc++)
          if (b[r + dr][c + dc] == '*') cnt++;
      if (cnt == 1) return true;
    }
  return false;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%s", b[i]);
  queue<pair<int, int> > q;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (rem(i, j)) {
        q.push(make_pair(i, j));
      }
    }
  }
  while (!q.empty()) {
    int r = q.front().first;
    int c = q.front().second;
    q.pop();
    if (!rem(r, c)) continue;
    b[r][c] = '.';
    for (int dr = -1; dr <= 1; dr++)
      for (int dc = -1; dc <= 1; dc++) {
        if (dr == 0 && dc == 0) continue;
        int nr = r + dr, nc = c + dc;
        if (0 <= nr && nr < n)
          if (0 <= nc && nc < m)
            if (b[nr][nc] == '*') {
              q.push(make_pair(nr, nc));
            }
      }
  }
  for (int i = 0; i < n; i++) {
    printf("%s\n", b[i]);
  }
  return 0;
}
