Write a program that reads a sequence of characters, each one
codifying a movement (‘n’ for north, ‘s’ for
south, ‘e’ for east, and ‘w’ for west), and
that computes the final position of an object initially located at
.
Suppose that the first component corresponds to the east-west direction,
that going est means adding 1 to that component, and that going south
means adding 1 to the second component.
Input consists of a sequence of characters ‘n’,
‘s’, ‘e’, or ‘w’.
Print the final position of an object initially located at .
Input
nnnn
Output
(0, -4)
Input
ssewwwwn
Output
(-3, 1)
Input
Output
(0, 0)