Movements on the ground

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 (0,0)(0, 0). 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

Input consists of a sequence of characters ‘n’, ‘s’, ‘e’, or ‘w’.

Output

Print the final position of an object initially located at (0,0)(0, 0).

Problem information

Author: Unknown
Translator: Salvador Roura

Generation: 2026-01-25T12:04:29.194Z

© Jutge.org, 2006–2026.
https://jutge.org