Company: Goldman Sachs OA
Difficulty: medium
3. Direction Games Sara loves exploring new places, but she often gets lost. To help her out, you decide to write a program that will track her proposed path, and determine if she returns to her starting position at the end of the path or not. Sara will input the path as a string, where each character in the string represents the direction she walks in for exactly one minute. The possible directions are: N for North S for South E for East W for West Your task is to write a program that accepts P strings, representing P paths, and determine if Sara ends up at the starting point at the end of each path. If she ends up at the starting point, print "true"; otherwise, print "false". Read the input from STDIN and print the output to STDOUT. Do not print arbitrary strings anywhere in the program, as these contribute to the standard output, and your test cases will fail. Constraints 1 <= P <= 50 1 <= Length of each path <= 100 The string is made up of ONLY the uppercase characters