#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
int main() {
  int r, c;
  cin >> r >> c;
  char grid[r + 10][c + 10], cell[r + 10][c + 10];
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      cin >> grid[i][j];
      cell[i][j] = grid[i][j];
    }
  }
  bool flag = true;
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      if (grid[i][j] == 'S') {
        for (int k = 0; k < 4; k++) {
          int row = i + dx[k];
          int col = j + dy[k];
          if (row >= 0 && row < r && col >= 0 && col < c) {
            if (grid[row][col] == 'W') {
              flag = false;
            } else if (grid[row][col] == '.') {
              cell[row][col] = 'D';
            }
          }
        }
      }
    }
  }
  if (!flag) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      cout << cell[i][j];
    }
    cout << endl;
  }
  return 0;
}
