#include <bits/stdc++.h>
using namespace std;
const int N = 10000005;
int main() {
  iostream::sync_with_stdio(false);
  cin.tie(NULL);
  int r, c;
  cin >> r >> c;
  vector<vector<char>> v(r, vector<char>(c));
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      cin >> v[i][j];
    }
  }
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      if (v[i][j] == 'S') {
        bool w = true, a = true, s = true, d = true;
        if (i > 0)
          if (v[i - 1][j] == 'W') w = false;
        if (j > 0)
          if (v[i][j - 1] == 'W') a = false;
        if (i < r - 1)
          if (v[i + 1][j] == 'W') s = false;
        if (j < c - 1)
          if (v[i][j + 1] == 'W') d = false;
        if (!w || !a || !s || !d) {
          cout << "No";
          return 0;
        }
      } else if (v[i][j] == '.')
        v[i][j] = 'D';
    }
  }
  cout << "YES\n";
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      cout << v[i][j];
    }
    if (i < r - 1) cout << endl;
  }
  return 0;
}
