#include <bits/stdc++.h>
using namespace std;
int n, m;
int _top, _left, _bottom, _right;
bool visit[2010][2010];
char graph[2010][2010];
int delta_r[] = {0, -1, -1, -1, 0, 1, 1, 1};
int delta_c[] = {-1, -1, 0, 1, 1, 1, 0, -1};
void dfs(int r, int c) {
  for (int i = 0; i < 8; i += 2) {
    int cnt = 0;
    for (int k = 1, j = i; k <= 3; k++, j++) {
      if (j >= 8) j %= 8;
      int nr = r + delta_r[j];
      int nc = c + delta_c[j];
      if (graph[nr][nc] == '.') ++cnt;
    }
    if (cnt == 3) {
      graph[r][c] = '.';
      for (int i = 0; i < 8; i++) {
        int nr = r + delta_r[i];
        int nc = c + delta_c[i];
        if (graph[nr][nc] == '*') dfs(nr, nc);
      }
    }
  }
}
int main() {
  cin >> n >> m;
  memset(visit, 0, sizeof(visit));
  for (int i = 1; i <= n; i++) {
    cin >> graph[i] + 1;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (graph[i][j] == '*') dfs(i, j);
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cout << graph[i][j];
    }
    cout << endl;
  }
  return 0;
}
