#include<iostream>
#include<cstdio>
#include<stdio.h>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
int main()
{
char a[110][110];
int f,e,s1,s2,o=0;
cin>>s1>>s2;
for(f=1; f<=s1; f++)
{
for(e=1; e<=s2; e++)
{
cin>>a[f][e];
}
}
for(f=1; f<=s1; f++)
{
for(e=1; e<=s2; e++)
{
o=0;
if(a[f][e]=='*')
cout<<"*";
else { if(a[f-1][e-1]=='*')
o=o+1;
//1;
if(a[f-1][e]=='*') o=o+1;