#include <bits/stdc++.h>
using namespace std;
char a[2000 + 10][2000 + 10];
int n, m;
int dx[] = {0, 1, 1, 0};
int dy[] = {1, 1, 0, 0};
void change(int x, int y) {
  if (x < 0 || x >= n - 1 || y >= m - 1 || y < 0) return;
  int num = 0;
  int fx, fy;
  for (int i = 0; i < 4; i++) {
    int xx = x + dx[i];
    int yy = y + dy[i];
    if (a[xx][yy] == '*') {
      num++;
      fx = xx;
      fy = yy;
    }
  }
  if (num == 1) {
    a[fx][fy] = '.';
    for (int i = -1; i <= 1; i++)
      for (int j = -1; j <= 1; j++) change(fx + i, fy + j);
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> a[i][j];
  for (int i = 0; i < n - 1; i++)
    for (int j = 0; j < m - 1; j++) change(i, j);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cout << a[i][j];
    cout << '\n';
  }
  return 0;
}
