#include <bits/stdc++.h>
using namespace std;
const int dx[4] = {1, -1, 0, 0}, dy[4] = {0, 0, 1, -1};
void dfs(pair<int, int> t, vector<string> &vs, vector<vector<bool>> &used) {
  used[t.first][t.second] = true;
  for (int i = 0; i < 4; ++i) {
    pair<int, int> to = t;
    to.first += dx[i];
    to.second += dy[i];
    if (to.first < 0 || to.first >= vs.size() || to.second < 0 ||
        to.second >= vs[0].size()) {
      continue;
    }
    if (vs[to.first][to.second] == 'S') {
      cout << "No";
      exit(0);
    }
    if (!used[to.first][to.second]) {
      dfs(to, vs, used);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<string> vs(n);
  vector<vector<bool>> used(n);
  for (int i = 0; i < n; ++i) {
    cin >> vs[i];
    for (int j = 0; j < m; ++j) {
      if (vs[i][j] == '.') {
        used[i].push_back(true);
        vs[i][j] = 'D';
      } else {
        used[i].push_back(false);
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (vs[i][j] == 'W') {
        pair<int, int> t = make_pair(i, j);
        dfs(t, vs, used);
      }
    }
  }
  cout << "Yes" << endl;
  for (int i = 0; i < n; ++i) {
    cout << vs[i] << endl;
  }
  return 0;
}
