#include <bits/stdc++.h>
using namespace std;
int vis[2005][2005];
int a, b;
queue<pair<int, int> > luv;
char arr[2005][2005];
bool check(int aa, int bb) {
  if (aa < 2 || bb < 2) return false;
  if (vis[aa][bb]) return false;
  int l = 0;
  if (arr[aa - 1][bb] == '*') l++;
  if (arr[aa][bb] == '*') l++;
  if (arr[aa][bb - 1] == '*') l++;
  if (arr[aa - 1][bb - 1] == '*') l++;
  if (l == 1) return true;
  return false;
}
inline void checkadjacent(int x1, int y1) {
  if (x1 + 1 <= a && y1 + 1 <= b) {
    if (!vis[x1 + 1][y1 + 1] && check(x1 + 1, y1 + 1)) {
      luv.push(pair<int, int>(x1 + 1, y1 + 1));
      vis[x1 + 1][y1 + 1] = 1;
    }
  }
  if (x1 + 1 <= a) {
    if (!vis[x1 + 1][y1] && check(x1 + 1, y1)) {
      luv.push(pair<int, int>(x1 + 1, y1));
      vis[x1 + 1][y1] = 1;
    }
  }
  if (y1 + 1 <= b && !vis[x1][y1 + 1]) {
    if (check(x1, y1 + 1)) {
      luv.push(pair<int, int>(x1, y1 + 1));
      vis[x1][y1 + 1] = 1;
    }
  }
  if (!vis[x1][y1] && check(x1, y1)) {
    luv.push(pair<int, int>(x1, y1));
    vis[x1][y1] = 1;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> a >> b;
  for (int g = 1; g <= a; g++) {
    for (int y = 1; y <= b; y++) {
      cin >> arr[g][y];
      if (check(g, y)) {
        luv.push(pair<int, int>(g, y));
        vis[g][y]++;
      }
    }
  }
  while (luv.size()) {
    pair<int, int> x = luv.front();
    luv.pop();
    int x1 = x.first, y1 = x.second;
    if (arr[x1 - 1][y1] == '*') {
      arr[x1 - 1][y1] = '.';
      checkadjacent(x1 - 1, y1);
    }
    if (arr[x1][y1] == '*') {
      arr[x1][y1] = '.';
      checkadjacent(x1, y1);
    }
    if (arr[x1][y1 - 1] == '*') {
      arr[x1][y1 - 1] = '.';
      checkadjacent(x1, y1 - 1);
    }
    if (arr[x1 - 1][y1 - 1] == '*') {
      arr[x1 - 1][y1 - 1] = '.';
      checkadjacent(x1 - 1, y1 - 1);
    }
  }
  for (int g = 1; g <= a; g++) {
    for (int y = 1; y <= b; y++) {
      printf("%c", arr[g][y]);
    }
    printf("\n");
  }
}
