#include <bits/stdc++.h>
using namespace std;
int n, m;
char a[2020][2020];
int mx[8] = {0, 1, -1, 0, 1, -1, -1, 1};
int my[8] = {1, 0, 0, -1, 1, -1, 1, -1};
int check(int x, int y) {
  if (x < 1 || x > n) return 0;
  if (y < 1 || y > m) return 0;
  return (a[x][y] == '.');
}
int exam(int i, int j) {
  if (check(i - 1, j) && check(i, j - 1) && check(i - 1, j - 1)) return 1;
  if (check(i - 1, j) && check(i, j + 1) && check(i - 1, j + 1)) return 1;
  if (check(i + 1, j) && check(i, j - 1) && check(i + 1, j - 1)) return 1;
  if (check(i + 1, j) && check(i, j + 1) && check(i + 1, j + 1)) return 1;
  return 0;
}
void DFS(int x, int y) {
  for (int i = 0; i < 8; ++i) {
    int nx = x + mx[i];
    int ny = y + my[i];
    if (nx >= 1 && nx <= n && ny >= 1 && ny <= m && a[nx][ny] == '*' &&
        exam(nx, ny))
      a[nx][ny] = '.', DFS(nx, ny);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) cin >> a[i][j];
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      if (a[i][j] == '*') {
        if (exam(i, j)) a[i][j] = '.', DFS(i, j);
      }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) cout << a[i][j];
    cout << endl;
  }
  return 0;
}
