#include <bits/stdc++.h>
using namespace std;
int n, m;
int step[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
string a[505];
bool f(int r, int b) {
  for (int i = 0; i < 4; i++) {
    int x = r + step[i][1];
    int y = b + step[i][0];
    if (x >= 0 && x < n && y >= 0 && y < m) {
      if (a[x][y] == 'S') return 1;
    }
  }
  return 0;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  bool p = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (a[i][j] == 'W') {
        if (f(i, j)) {
          p = 1;
          break;
        }
      } else if (a[i][j] == '.') {
        a[i][j] = 'D';
      }
    }
    if (p) break;
  }
  if (p)
    cout << "No" << endl;
  else {
    cout << "Yes" << endl;
    for (int i = 0; i < n; i++) cout << a[i] << endl;
  }
}
