#include <bits/stdc++.h>
using namespace std;
const int M = 500 + 20;
pair<int, int> a[4] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
bool mark[M][M];
string s[M];
int r, c;
bool valid(int x, int y) {
  if (x >= 0 && y >= 0 && x < r && y < c) return true;
  return false;
}
int main() {
  cin >> r >> c;
  for (int i = 0; i < r; i++) cin >> s[i];
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      if (s[i][j] == 'S') {
        for (int k = 0; k < 4; k++) {
          int x = i + a[k].first;
          int y = j + a[k].second;
          if (valid(x, y)) {
            if (s[x][y] == 'W') {
              cout << "No\n";
              return 0;
            }
            if (s[x][y] == '.') {
              mark[x][y] = true;
            }
          }
        }
      }
    }
  }
  cout << "Yes\n";
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      if (mark[i][j])
        cout << 'D';
      else
        cout << s[i][j];
    }
    cout << "\n";
  }
  return 0;
}
