题解 | #坐标移动#
坐标移动
http://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
str = input().split(';') x,y = 0,0 for i in range(len(str)): str1 = str[i] if (str1.count('A') == 1 or str1.count('D') == 1 or str1.count('W') == 1 or str1.count('S') == 1): if len(str1) == 2: if 'A' in str1: x -= int(str1[1]) if 'D' in str1: x += int(str1[1]) if 'W' in str1: y += int(str1[1]) if 'S' in str1: y -= int(str1[1]) if len(str1) == 3: if 'A' in str1: x -= int(str1[1:]) if 'D' in str1: x += int(str1[1:]) if 'W' in str1: y += int(str1[1:]) if 'S' in str1: y -= int(str1[1:]) print("{},{}".format(x,y))