{{#include <iostream>
#include <vector>
#include <queue>
#include <string_view>
#include <algorithm>

constexpr int MAXN = 1000;
constexpr int INF = 1e9;
std::array<std::array<int, MAXN>, MAXN> prevX, prevY;
std::array<int, 4> dx{0, 0, -1, 1};
std::array<int, 4> dy{-1, 1, 0, 0};
constexpr std::string_view dir{"WENS"};
uint16_t N, M;

std::string generatePath(int x, int y) {
    std::string path;
    while(x != 0 || y != 0) {
        int px = prevX[x][y];
        int py = prevY[x][y];
        for(int i = 0; i < 4; i++){
            if(px + dx[i] == x && py + dy[i] == y) {
                path += dir[i];
                break;
            }
        }
        x = px;
        y = py;
    }
    std::reverse(path.begin(), path.end());
    return path;
}


void bfs(int16_t x1,
         int16_t y1,
         std::vector<std::vector<int>> & dist,
         const std::vector<std::vector<char>> & world){
    std::queue<std::pair<int16_t, int16_t>> q;
    q.emplace(x1, y1);
    dist[x1][y1] = 0;
    while(!q.empty()) {
        int16_t x = q.front().first;
        int16_t y = q.front().second;
        q.pop();
        for(int i = 0; i < 4; i++) {
            int16_t nx = x + dx[i];
            int16_t ny = y + dy[i];
            if (nx >= 0 && nx < N && ny >= 0 && ny < M && world[nx][ny] != '#'){
                int w = (world[nx][ny] == 'W') ? 2 : 1;
                if(dist[nx][ny] > dist[x][y] + w) {
                    dist[nx][ny] = dist[x][y] + w;
                    prevX[nx][ny] = x;
                    prevY[nx][ny] = y;
                    q.emplace(nx, ny);
                }
            }
        }
    }


}
int main(){
    int16_t x1, y1, x2, y2;
    std::cin >> N >> M >> x1 >> y1 >> x2 >> y2;
    x1--; y1--; x2--; y2--;
    std::vector<std::vector<int>> dist(N, std::vector<int>(M,INF));
    std::vector<std::vector<char>> world(N, std::vector<char>(M));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
            std::cin >> world[i][j];
        }
    }
    bfs(x1, y1, dist, world);
    if(dist[x2][y2] == 1e9) {
        std::cout << -1 << std::endl;
        return 0;
    }
    std::cout << dist[x2][y2] << std::endl;
    std::cout << generatePath(x2, y2) << std::endl;
}}} fix /temp/compiling/source.cpp:9:6: error: ‘array’ in namespace ‘std’ does not name a template type
 std::array<std::array<int, MAXN>, MAXN> prevX, prevY;
      ^~~~~
/temp/compiling/source.cpp:10:6: error: ‘array’ in namespace ‘std’ does not name a template type
 std::array<int, 4> dx{0, 0, -1, 1};
      ^~~~~
/temp/compiling/so Provide exactly two different responses that are separated with 6 asterisk symbols: ******.
user