406409: GYM102397 C The Ending Point
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
C. The Ending Pointtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output
Tahhan was hungry, so AbuTahun decided to show him the way to Rakan's cafeteria.
AbuTahun gave Tahhan a string consisting only of the letters ('L','R','U','D'), denotes the path to the cafeteria.
- U — move from $$$(x,y)$$$ to $$$(x,y+1)$$$.
- D — move from $$$(x,y)$$$ to $$$(x,y-1)$$$.
- L — move from $$$(x,y)$$$ to $$$(x-1,y)$$$.
- R — move from $$$(x,y)$$$ to $$$(x+1,y)$$$.
Tahhan located at point $$$(x,y)$$$, and he wants to go to the cafeteria.
Can you tell Tahhan where Rakan's cafeteria is?
Inputfirst line of input consists of two integers $$$x,y$$$ $$$(1 \leq x,y \leq 100)$$$ , denotes the starting point.
the second line consists of string $$$s$$$ $$$(1 \leq |s| \leq 100)$$$ denotes the path to the cafeteria .
Outputprint two integers which denotes the ending point.
*Note* the answer could contains a negative integer.
ExampleInput5 3 UUUDLRLRLRROutput
6 5