Check if it is possible to return to the starting position after moving in the given directions | driver code ; let n = 0 ; Count of North let s = 0 ; Count of South let e = 0 ; Count of East let w = 0 ; Count of West
let st = " " ; let len = st . length ; for ( let i = 0 ; i < len ; i ++ ) { if ( st [ i ] == ' ' ) n += 1 ; if ( st [ i ] == ' ' ) s += 1 ; if ( st [ i ] == ' ' ) w += 1 ; if ( st [ i ] == ' ' ) e += 1 ; } if ( n == s && w == e ) document . write ( " " ) ; else document . write ( " " ) ;