320 - Border


Difficulty : easy

Solution Description :

Output related array manipulation problem

For command east (E)
----- increment x by 1
For command north (N)
----- increment y by 1
For command west (W)
----- decrements x by 1
For command south (S)
----- decrements y by 1

For using this procedure then you can make the border line not the exact output 
For input
2 1
EENNWNENWWWSSSES.
y
|
|
7 . . . . . . .
6 . . . . . . .
5 . + + + + . .
4 . + . + + . .
3 . + . + + . .
2 . + + . + . .
1 . . + + + . .
0 . . . . . . .
  0 1 2 3 4 5 6 -----> x
Here red + indicate the start position.

For exact output you need some extra work.
y
|
|
7 . . . . . . .
6 . . . . . . .
5 . X X X . . .
4 X . . . X . .
3 X . . X . . .
2 X . . . X . .
1 . X . . X . .
0 . . X X . . .
  0 1 2 3 4 5 6 ---> x

For command E you need to convert (3, 1) -> (2, 0) i.e. (x, y) -> (x-1, y-1)
For command N you need to convert (4, 2) -> (4, 1) i.e. (x, y) -> (x, y-1)
For command W you need to convert (3, 3) -> (3, 3) i.e. (x, y) -> (x, y)
For command S you need to convert (1, 4) -> (0, 4) i.e. (x, y) -> (x-1, y)

So, do this simulation. You can use character array a[32][32], and initially fill all character by '.'. 
For each input, the value of x and y are IN BETWEEN the grid. Do not need to check the out of boundary.