#include <stdio.h>

#define MAXN    300

char f[MAXN][MAXN];
char g[MAXN][MAXN];
int sum1[MAXN + 1][MAXN + 1];
int sum2[MAXN + 1][MAXN + 1];
int n, m;

#define CELL_WHITE      1
#define CELL_BLACK      -1
#define CELL_UNKNOWN    0

#define MAX(a, b)       (((a) > (b)) ? (a) : (b))
#define MIN(a, b)       (((a) < (b)) ? (a) : (b))

void mark(int k, int u, int v, char color) {
    int i, j;

    for (i = 0; i < k; i++) {
        for (j = 0; j < k; j++) {
            if (((i <= u) && (j <= v)) || ((u < i) && (v < j))) {
                g[i][j] = color;
            } else {
                g[i][j] = -color;
            }
        }
    }
}

char valid(int k) {
    int i, j, cur1, cur2;

    for (i = 1; i <= k; i++) {
        cur1 = 0;
        cur2 = 0;
        for (j = 1; j <= k; j++) {
            cur1 = (g[i - 1][j - 1] == CELL_WHITE) ? (cur1 + 1) : cur1;
            cur2 = (g[i - 1][j - 1] == CELL_BLACK) ? (cur2 + 1) : cur2;

            sum1[i][j] = sum1[i - 1][j] + cur1;
            sum2[i][j] = sum2[i - 1][j] + cur2;
        }
    }

    for (i = 0; i < k; i++) {
        for (j = 0; j < k; j++) {
            if ((sum1[i + 1][j + 1] == 0) && (sum1[k][k] - sum1[k][j + 1] - sum1[i + 1][k] == 0) && (sum2[k][j + 1] == sum2[i + 1][j + 1]) && (sum2[i + 1][k] == sum2[i + 1][j + 1])) {
                mark(k, i, j, CELL_BLACK);
                return 1;
            }
            if ((sum2[i + 1][j + 1] == 0) && (sum2[k][k] - sum2[k][j + 1] - sum2[i + 1][k] == 0) && (sum1[k][j + 1] == sum1[i + 1][j + 1]) && (sum1[i + 1][k] == sum1[i + 1][j + 1])) {
                mark(k, i, j, CELL_WHITE);
                return 1;
            }
        }
    }

    return 0;
}

int main() {
    int i, j, k, cur1, cur2, ii, jj, neg;
    char tmp, found;
    int maxk, k2;

    freopen("chess.in", "r", stdin);
    freopen("chess.out", "w", stdout);

    scanf("%d %d", &n, &m);
    for (i = 0; i < n; i++) {
        for (j = 0; j < m; j++) {
            char ch = getc(stdin);
            while (ch != '.' && ch != '*' && ch != '?')
                ch = getc(stdin);

            if (ch == '.')
                f[i][j] = CELL_WHITE;
            else if (ch == '*')
                f[i][j] = CELL_BLACK;
            else
                f[i][j] = CELL_UNKNOWN;
        }
    }

    maxk = MAX(n, m);
    found = 0;
    for (k = 1; k <= maxk; k++) {
        k2 = k + k;
        for (i = 0; i < k; i++)
            for (j = 0; j < k; j++)
                g[i][j] = CELL_UNKNOWN;

        for (i = 0; i < n; i++)
            for (j = 0; j < m; j++)
                g[i][j] = f[i][j];

        ii = -1;
        for (i = 0; i < n; i++) {
            ii = ((ii + 1 == k2) ? 0 : (ii + 1));
            jj = -1;
            for (j = 0; j < m; j++) {
                jj = ((jj + 1 == k2) ? 0 : (jj + 1));
                if (g[i][j] == CELL_UNKNOWN)
                    continue;

                cur1 = ii;
                cur2 = jj;
                neg = 0;
                if (cur1 >= k) { neg = neg ^ 1; cur1 = cur1 - k; }
                if (cur2 >= k) { neg = neg ^ 1; cur2 = cur2 - k; }
                tmp = (neg == 0) ? g[i][j] : -g[i][j];
                if (g[cur1][cur2] == CELL_UNKNOWN) {
                    g[cur1][cur2] = tmp;
                    continue;
                }

                if (g[cur1][cur2] != tmp) {
                    goto restart;
                }
            }
        }

        if (valid(k) == 0)
            continue;

        found = 1;
        for (i = 0; i < n; i++) {
            for (j = 0; j < m; j++) {
                cur1 = i % (2 * k);
                cur2 = j % (2 * k);
                neg = 0;
                if (cur1 >= k) { neg = neg ^ 1; cur1 = cur1 - k; }
                if (cur2 >= k) { neg = neg ^ 1; cur2 = cur2 - k; }
                tmp = ((neg == 0) ? g[cur1][cur2] : -g[cur1][cur2]);

                f[i][j] = (tmp == CELL_BLACK) ? '*' : '.';
            }
        }
        break;

restart:
        k = k; // To suppress warning :)
    }

    if (found == 0) {
        printf("NO\n");
    } else {
        printf("YES\n");
        for (i = 0; i < n; i++) {
            for (j = 0; j < m; j++) {
                printf("%c", f[i][j]);
            }
            printf("\n");
        }
    }

    return 0;
}
