#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e3 + 100;
struct Point {
  int x, y;
  Point(int x, int y) : x(x), y(y) {}
};
queue<Point> q;
char mp[maxn][maxn];
int n, m;
void judge(int x, int y) {
  if (x < 0 || y < 0) return;
  if (x + 1 >= n || y + 1 >= m) return;
  int cnt = 0;
  for (int i = x; i < x + 2; i++) {
    for (int j = y; j < y + 2; j++) {
      if (mp[i][j] == '*') cnt++;
    }
  }
  if (cnt == 1)
    for (int i = x; i < x + 2; i++) {
      for (int j = y; j < y + 2; j++) {
        if (mp[i][j] == '*') {
          mp[i][j] = '.';
          q.push(Point(i, j));
        }
      }
    }
}
void bfs(Point now) {
  judge(now.x - 1, now.y - 1);
  judge(now.x - 1, now.y);
  judge(now.x, now.y);
  judge(now.x, now.y - 1);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%s", mp[i]);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      q.push(Point(i, j));
    }
  while (!q.empty()) {
    Point now = q.front();
    q.pop();
    bfs(now);
  }
  for (int i = 0; i < n; i++) printf("%s\n", mp[i]);
  return 0;
}
