25: Coordinate movement Coordinatemove

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.