#include <bits/stdc++.h>
using namespace std;
int dh[5] = {0, 0, -1, 0, 1};
int dc[5] = {0, 1, 0, -1, 0};
const int N = 505;
int m, n;
char s[N][N];
int main() {
  cin >> m >> n;
  for (int i = 1; i <= m; i++) cin >> s[i] + 1;
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++) {
      if (s[i][j] == 'W') {
        for (int k = 1; k <= 4; k++) {
          if (s[i + dh[k]][j + dc[k]] == 'S') {
            cout << "NO";
            return 0;
          }
        }
      }
    }
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++) {
      if (s[i][j] == 'W') {
        for (int k = 1; k <= 4; k++) {
          if (s[i + dh[k]][j + dc[k]] == '.') {
            s[i + dh[k]][j + dc[k]] = 'D';
          }
        }
      }
    }
  cout << "YES" << endl;
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++) {
      cout << s[i][j];
      if (j == n) cout << endl;
    }
}
