|
|||
PlaneA woman is walking on an infinite plane (a mathematical plane, not an airplane) divided into squares. She can move one square to the north, south, east, or west with each step. You will be given the walk this woman takes on this plane. You are to print out the number of distinct squares (including her starting square) that she visited on the walk. A square only counts once in the count, no matter how many times it has been visited (provided that it HAS been visited). Input Specification
The first line of the input will consist of a decimal integer N between 1 and 100
inclusive, representing the number of test cases that will follow. What will then follow are
N lines, corresponding to the test cases. Each line will contain a string of
characters from { Output SpecificationThe test cases in the output should appear in the order in which they appear in the input. Each test case in the output will be a positive decimal integer, followed by a newline character, equal to the number of squares the woman has visited. No extra newline characters should appear in the output. Sample Input
Output for Sample Input
Original Problem |
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |