#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c, flag = 1;
  scanf("%d%d%*c", &r, &c);
  static char inp[555][555], n;
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) scanf("%c", &inp[i][j]);
    scanf("%c", &n);
  }
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      if (inp[i][j] == 'S') {
        if ((j + 1) < c && inp[i][j + 1] == 'W') flag = 0;
        if ((j - 1) >= 0 && inp[i][j - 1] == 'W') flag = 0;
        if ((i + 1) < r && inp[i + 1][j] == 'W') flag = 0;
        if ((i - 1) >= 0 && inp[i - 1][j] == 'W') flag = 0;
      }
    }
  }
  if (flag) {
    cout << "YES" << endl;
    for (int i = 0; i < r; i++) {
      for (int j = 0; j < c; j++) cout << (inp[i][j] == '.' ? 'D' : inp[i][j]);
      cout << endl;
    }
  } else
    cout << "NO";
  return 0;
}
