Problem Link : https://www.codechef.com/problems/DRCTNSRM
Initial Approach :This problem can simply be solved by considering sumit position be a point on a 2D x-y graph.
Final Approach : Now to take another step to solve the problem, declare and initiate two variable denoting the distance traveled in parallel to a particular axis. Iterate through the string and increment the variable for x axis if ‘N’ occurs and decrement it if ‘S’ occurs. Same goes with ‘E’ and ‘W’.It is to be noted that final position of the sumit will never be (0,0) as already mentioned in the problem.
Solution : https://ideone.com/c2aiC8