题解 | #坐标移动#
坐标移动
https://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
while True: rl = [] ud = [] try: s = input().split(';') for i in s: if len(i) >= 2: if i[0] == 'A' and i[1:].isdigit(): rl.append(-int(i[1:])) elif i[0] == 'D' and i[1:].isdigit(): rl.append(int(i[1:])) elif i[0] == 'W' and i[1:].isdigit(): ud.append(int(i[1:])) elif i[0] == 'S' and i[1:].isdigit(): ud.append(-int(i[1:])) else: continue x = sum(rl) y = sum(ud) print('{},{}'.format(x,y)) except: break