#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c, i, j;
  cin >> r >> c;
  char k[r + 2][c + 2];
  for (i = 0; i <= r + 1; i++)
    for (j = 0; j <= c + 1; j++) k[i][j] = '.';
  for (i = 1; i <= r; i++)
    for (j = 1; j <= c; j++) cin >> k[i][j];
  for (i = 1; i <= r; i++)
    for (j = 1; j <= c; j++) {
      if (k[i][j] == 'S') {
        if (k[i + 1][j] == 'W' || k[i][j + 1] == 'W' || k[i - 1][j] == 'W' ||
            k[i][j - 1] == 'W') {
          cout << "NO" << endl;
          return 0;
        }
      } else if (k[i][j] == '.')
        k[i][j] = 'D';
    }
  cout << "YES" << endl;
  for (i = 1; i <= r; i++) {
    for (j = 1; j <= c; j++) cout << k[i][j];
    cout << endl;
  }
  return 0;
}
