#include <bits/stdc++.h>
using namespace std;
int n, m;
int sq[2010][2010];
void dfs(int, int);
void check(int, int, int, int);
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    char s[2010];
    scanf("%s", s + 1);
    for (int j = 1; j <= m; j++) {
      if (s[j] == '*')
        sq[i][j] = 2;
      else if (s[j] == '.')
        sq[i][j] = 1;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (sq[i][j] == 2) dfs(i, j);
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (sq[i][j] == 1)
        printf(".");
      else if (sq[i][j] == 2)
        printf("*");
    }
    printf("\n");
  }
  return 0;
}
void dfs(int x, int y) {
  if (!x || !y) return;
  check(x, y, 1, 1);
  check(x, y, 1, -1);
  check(x, y, -1, -1);
  check(x, y, -1, 1);
  return;
}
void check(int x, int y, int a, int b) {
  int cnt2 = 0, y2, x2, cnt1 = 0;
  if (sq[x][y] == 2)
    x2 = x, y2 = y, cnt2++;
  else if (sq[x][y] == 1)
    cnt1++;
  if (sq[x + a][y] == 2)
    x2 = x + a, y2 = y, cnt2++;
  else if (sq[x + a][y] == 1)
    cnt1++;
  if (sq[x][y + b] == 2)
    x2 = x, y2 = y + b, cnt2++;
  else if (sq[x][y + b] == 1)
    cnt1++;
  if (sq[x + a][y + b] == 2)
    x2 = x + a, y2 = y + b, cnt2++;
  else if (sq[x + a][y + b] == 1)
    cnt1++;
  if (cnt2 == 1 && cnt1 == 3) {
    sq[x2][y2] = 1;
    dfs(x2, y2);
  }
  return;
}
