#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c;
  cin >> r >> c;
  char ar[r][c];
  for (int i = 0; i < r; i++)
    for (int j = 0; j < c; j++) cin >> ar[i][j];
  bool counter = true;
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      if (ar[i][j] == 'S') {
        if (i + 1 < r && ar[i + 1][j] == '.')
          ar[i + 1][j] = 'D';
        else if (i + 1 < r && ar[i + 1][j] == 'W')
          counter = false;
        if (i - 1 >= 0 && ar[i - 1][j] == '.')
          ar[i - 1][j] = 'D';
        else if (i - 1 >= 0 && ar[i - 1][j] == 'W')
          counter = false;
        if (j + 1 < c && ar[i][j + 1] == '.')
          ar[i][j + 1] = 'D';
        else if (j + 1 < c && ar[i][j + 1] == 'W')
          counter = false;
        if (j - 1 >= 0 && ar[i][j - 1] == '.')
          ar[i][j - 1] = 'D';
        else if (j - 1 >= 0 && ar[i][j - 1] == 'W')
          counter = false;
        if (!counter) goto end;
      }
    }
  }
  cout << "YES\n";
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) cout << ar[i][j];
    cout << "\n";
  }
  return 0;
end:
  cout << "No";
  return 0;
}
