import java.io.*;
import java.util.*;

public class chess_ia implements Runnable {

	private BufferedReader in;
	private PrintWriter out;

	public void run() {
		try {
			solve();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	private void solve() throws Exception {
		Locale.setDefault(Locale.US);
		in = new BufferedReader(new FileReader("chess.in"));
		out = new PrintWriter("chess.out");
		StringTokenizer st = new StringTokenizer(in.readLine());
		int m = Integer.parseInt(st.nextToken());
		int n = Integer.parseInt(st.nextToken());
		int[][] a = new int[m][n];
		for (int i = 0; i < m; i++) {
			char[] tmp = in.readLine().toCharArray();
			for (int j = 0; j < n; j++) {
				if (tmp[j] == '*') {
					a[i][j] = 1;
				} else if (tmp[j] == '.') {
					a[i][j] = 2;
				} else {
					a[i][j] = 0;
				}
			}
		}
		
		int lim = Math.max(n, m);
		
		int kk = -1;
		
		int[][] b = new int[lim][lim];
		int[][] min = new int[2][lim + 1];
		int[][] max = new int[2][lim + 1];
		int[][] minR = new int[2][lim + 1];
		int[][] maxR = new int[2][lim + 1];
		boolean[][] ans = null;
		MAIN: for (int k = 1; k <= lim; k++) {
			for (int i = 0; i < lim; i++) {
				for (int j = 0; j < lim; j++) {
					b[i][j] = 0;
				}
			}
			
			int ik = -1;
			boolean ib = false;
			for (int i = 0; i < m; i++) {
				ik++;
				if (ik == k) {
					ik = 0;
					ib = !ib;
				}
				int jk = -1;
				boolean jb = false;
				for (int j = 0; j < n; j++) {
					jk++;
					if (jk == k) {
						jk = 0;
						jb = !jb;
					}
					if (a[i][j] > 0) {
						b[ik][jk] |= ((a[i][j] == 2) ^ ib ^ jb) ? 2 : 1;
						if (b[ik][jk] > 2) {
							continue MAIN;
						}
					}
				}
			}
			
			for (int z = 0; z < 2; z++) {
				min[z][0] = lim;
				max[z][0] = -1;
				minR[z][k] = lim;
				maxR[z][k] = -1;
			}
			
			for (int i = 0; i < k; i++) {
				for (int z = 0; z < 2; z++) {
					min[z][i + 1] = min[z][i];
					max[z][i + 1] = max[z][i];
				}
				for (int j = 0; j < k; j++) {
					if (b[i][j] > 0) {
						if (min[b[i][j] - 1][i + 1] > j) {
							min[b[i][j] - 1][i + 1] = j;
						}
						if (max[b[i][j] - 1][i + 1] < j) {
							max[b[i][j] - 1][i + 1] = j;
						}		
					}
				}
			}
			
			for (int i = k - 1; i >= 0; i--) {
				for (int z = 0; z < 2; z++) {
					minR[z][i] = minR[z][i + 1];
					maxR[z][i] = maxR[z][i + 1];
				}
				for (int j = 0; j < k; j++) {
					if (b[i][j] > 0) {
						if (minR[b[i][j] - 1][i] > j) {
							minR[b[i][j] - 1][i] = j;
						}
						if (maxR[b[i][j] - 1][i] < j) {
							maxR[b[i][j] - 1][i] = j;
						}		
					}
				}
			}
			
			for (int z = 0; z < 2; z++) {
				for (int i = 0; i <= k; i++) {
					int lo = Math.max(max[z][i], maxR[1 - z][i]);
					int hi = Math.min(min[1 - z][i], minR[z][i]);
					if (lo < hi) {
						kk = k;
						ans = new boolean[k][k];
						for (int ii = 0; ii < k; ii++) {
							for (int jj = 0; jj < k; jj++) {
								ans[ii][jj] = (ii < i) ^ (jj <= lo) ^ (z == 1);
							}
						}
						
						break MAIN;
					}
				}
			}
		}
		
		if (kk == -1) {
			out.println("NO");
		} else {
			out.println("YES");
			int ik = -1;
			boolean ib = false;
			for (int i = 0; i < m; i++) {
				ik++;
				if (ik == kk) {
					ik = 0;
					ib = !ib;
				}
				int jk = -1;
				boolean jb = false;
				for (int j = 0; j < n; j++) {
					jk++;
					if (jk == kk) {
						jk = 0;
						jb = !jb;
					}
					out.print((ans[ik][jk] ^ ib ^ jb) ? '.' : '*');
				}
				out.println();
			}
		}
		
		in.close();
		out.close();
	}

	public static void main(String[] args) {
		new Thread(new chess_ia()).start();
	}

}
