#include <bits/stdc++.h>
using namespace std;
int r, c;
string a[501];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, -1, 0, 1};
bool check(int i, int j) {
  int ret = true;
  for (int di = 0; di < 4; ++di) {
    int I = i + dx[di];
    int J = j + dy[di];
    if (I < 0 || I >= r || J < 0 || J >= c) continue;
    if (a[I][J] == 'W')
      ret = false;
    else if (a[I][J] == '.')
      a[I][J] = 'D';
  }
  return ret;
}
int main() {
  cin >> r >> c;
  for (int i = 0; i < r; ++i) cin >> a[i];
  bool ans = true;
  for (int i = 0; i < r; ++i)
    for (int j = 0; j < c; ++j)
      if (a[i][j] == 'S' && !check(i, j)) ans = false;
  if (ans) {
    cout << "Yes" << endl;
    for (auto aa : a) cout << aa << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
