Taru and Directions

Company: SDET_12oct

Difficulty: medium

Problem Statement

Taru and Directions Problem Description Tan gives Taru a list of moves written as a string. Each character is one move of one step: N - one step North S - one step South E - one step East W - one step West The list can be very long, so Taru wants to skip every move that does not matter. A move followed immediately by the opposite move on the same axis changes nothing: NS and SN cancel each other, and so do EW and WE . Such a pair of consecutive moves may be removed. After a pair is removed, the moves on both sides of it become consecutive, so the shorter string must be checked again for new removable pairs. Taru keeps removing pairs until no removable pair is left. Moves on different axes never cancel ( N followed by E stays), and two equal moves never cancel ( NN stays). Implement solve(s) , which returns the moves Taru still has to perform, in their original order, after every removable pair is gone. If no move is left, it returns the word HURRAY . Input Format The first and only lin