, you can only go up from this cell, specifically go from. holds, now you should determine the number of cells that one can be out if start walking on it.
Given a maze of size ntimes m n×m, where upper left corner is (1, 1)_{} (1,1) and lower right corner is (n, m)_{} (n,m) . For each cell (x, y)_{} (x,y) , there is exactly one character c~(cin {W, A, S, D}) c (c∈{W,A,S,D}) on it, denoting the moving restriction: * If c = W_{} c=W , you can only go up from this cell, specifically go from (x, y)_{} (x,y) to (x-1, y)_{} (x−1,y) * If c = A_{} c=A , you can only go left from this cell, specifically go from (x, y)_{} (x,y) to (x, y-1)_{} (x,y−1) * If c = S_{} c=S , you can only go down from this cell, specifically go from (x, y)_{} (x,y) to (x+1, y)_{} (x+1,y) * If c = D_{} c=D , you can only go right from this cell, specifically go from (x, y)_{} (x,y) to (x, y+1)_{} (x,y+1) We say one is out if x < 1_{} x<1 or x > n_{} x>n or y < 1_{} y<1 or y > m_{} y>m holds, now you should determine the number of cells that one can be out if start walking on it.