#include <bits/stdc++.h>
using namespace std;
char s[510][510];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> s[i][j];
  int flag = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (s[i][j] == 'S') {
        if (s[i - 1][j] == '.' && i - 1 >= 0) s[i - 1][j] = 'D';
        if (s[i + 1][j] == '.' && i + 1 < n) s[i + 1][j] = 'D';
        if (s[i][j - 1] == '.' && j - 1 >= 0) s[i][j - 1] = 'D';
        if (s[i][j + 1] == '.' && j + 1 < m) s[i][j + 1] = 'D';
        if (s[i - 1][j] == 'W' && i - 1 >= 0) {
          flag = 1;
          break;
        }
        if (s[i + 1][j] == 'W' && i + 1 < n) {
          flag = 1;
          break;
        }
        if (s[i][j - 1] == 'W' && j - 1 >= 0) {
          flag = 1;
          break;
        }
        if (s[i][j + 1] == 'W' && j + 1 < m) {
          flag = 1;
          break;
        }
      }
    }
  }
  if (flag)
    cout << "No" << endl;
  else {
    cout << "Yes" << endl;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) cout << s[i][j];
      cout << endl;
    }
  }
  return 0;
}
