#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c;
  cin >> r >> c;
  char a[r + 10][c + 10];
  for (int i = 0; i < r; i++)
    for (int j = 0; j < c; j++) cin >> a[i][j];
  for (int i = 0; i < r; i++)
    for (int j = 0; j < c; j++)
      if (a[i][j] == 'S' &&
          (j != 0 && a[i][j - 1] == 'W' || j != c - 1 && a[i][j + 1] == 'W' ||
           i != 0 && a[i - 1][j] == 'W' || i != r - 1 && a[i + 1][j] == 'W'))
        return cout << "NO", 0;
      else if (a[i][j] == '.')
        a[i][j] = 'D';
  cout << "YES" << endl;
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) cout << a[i][j];
    cout << endl;
  }
}
