#include <bits/stdc++.h>
using namespace std;
ifstream fin("commuting.in");
ofstream fout("commuting.out");
char s[2010][2010];
int cnt[2010][2010];
int n, m;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    cin >> s[i] + 1;
  }
  for (int i = 1; i < n; ++i) {
    for (int j = 1; j < m; ++j) {
      for (int k = 0; k < 2; ++k) {
        for (int h = 0; h < 2; ++h) {
          if (s[i + k][j + h] == '.') cnt[i][j]++;
        }
      }
    }
  }
  queue<int> q1, q2;
  for (int i = 1; i < n; ++i) {
    for (int j = 1; j < m; ++j) {
      if (cnt[i][j] == 3) {
        q1.push(i);
        q2.push(j);
      }
    }
  }
  while (!q1.empty()) {
    int i = q1.front();
    int j = q2.front();
    q1.pop();
    q2.pop();
    for (int k = 0; k < 2; ++k) {
      for (int h = 0; h < 2; ++h) {
        if (s[i + k][j + h] == '*') {
          s[i + k][j + h] = '.';
          int ii = i + k;
          int jj = j + h;
          for (int k = 0; k < 2; ++k) {
            for (int h = 0; h < 2; ++h) {
              cnt[ii - k][jj - h]++;
              if (cnt[ii - k][jj - h] == 3) {
                q1.push(ii - k);
                q2.push(jj - h);
              }
            }
          }
        }
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << s[i] + 1;
    cout << "\n";
  }
}
