Title Description
Develop a coordinate calculation tool, A for moving to the left,D for moving to the right,W for moving up, andS for moving down. Moves fromthe (0,0) point, reads some coordinates from the input string, and outputs the final input to the output file.
Input:
The legal coordinates are a ( or D or W or S) + number (within two bits), between coordinates ; Separated.
Illegal coordinate points need to be discarded. such as AA10; A1A; $%$; YAD; and so on.
The following is a simple example :
A10; S20; W10;d30; X A1A; B10A11;; A10;
Processing process:
Starting point (0,0)
+ A10 = (-10,0)
+ S20 = ( -10,-20)
+ W10 = ( -10,-10)
+ D30 = (20,-10)
+ x = Invalid
+ A1A = Invalid
+ B10A11 = Invalid
+ An empty does not affect
+ A10 = (10,-10)
Results ( -10)
Enter a description : a line of strings
Output Description : Final coordinates, to , separating
Input Example :
A10; S20; W10;d30; X A1A; B10A11;; A10;
Output Example :
10,-10
25: Coordinate movement Coordinatemove