#include <bits/stdc++.h>
using namespace std;
string vow = "aeiou";
long long month[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const long long dx[] = {-1, 0, 1, 0};
const long long dy[] = {0, 1, 0, -1};
const long double pie = 3.1415926535897932384626;
void a_b_c() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void solve() {
  long long r, c;
  cin >> r >> c;
  char a[r][c];
  for (long long i = 0; i < r; i++) {
    for (long long j = 0; j < c; j++) cin >> a[i][j];
  }
  for (long long i = 0; i < r; i++) {
    for (long long j = 0; j < c; j++) {
      if (a[i][j] == '.')
        a[i][j] = 'D';
      else if (a[i][j] == 'S' && (((j + 1) < c && (a[i][j + 1] == 'W')) ||
                                  ((j - 1) >= 0 && a[i][j - 1] == 'W') ||
                                  ((i - 1) >= 0 && a[i - 1][j] == 'W') ||
                                  ((i + 1) < r && a[i + 1][j] == 'W'))) {
        cout << "NO";
        return;
      }
    }
  }
  cout << "YES" << endl;
  for (long long i = 0; i < r; i++) {
    for (long long j = 0; j < c; j++) cout << a[i][j];
    cout << endl;
  }
}
int32_t main() {
  long long t = 1;
  while (t--) {
    solve();
  }
}
