#include <bits/stdc++.h>
using namespace std;
bitset<2005> a[2005];
int n, m, i, j, flag[2005][2005];
char s[2005];
inline void dfs(int x, int y) {
  if (x < 1 || x >= n || y < 1 || y >= m) return;
  int num = 0;
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++) num += a[x + i][y + j];
  if (num == 1) {
    for (int i = 0; i < 2; i++)
      for (int j = 0; j < 2; j++) a[x + i][y + j] = 0;
    for (int i = -1; i <= 2; i++)
      for (int j = -1; j <= 2; j++) dfs(x + i, y + j);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) {
    scanf("%s", s + 1);
    for (j = 1; j <= m; j++) a[i][j] = (s[j] == '*');
  }
  for (i = 1; i < n; i++)
    for (j = 1; j < m; j++) dfs(i, j);
  for (i = 1; i <= n; i++, puts(""))
    for (j = 1; j <= m; j++) putchar(a[i][j] ? '*' : '.');
}
