#本题非常简单 import sys data = sys.stdin.readlines() data = data[0].strip("\n") lines = data.split(";") # print(lines) new = [] def edc(opt,position): fangxiang=opt[0] zhi=int(opt[1:]) if fangxiang=='A': position=[position[0]-zhi,position[1]] if fangxiang=='S': position=[position[0],position[1]-zhi] if fangxiang=='W': position=[position[0],position[1]+zhi] if fangxiang=='D': position=[position[0]+zhi,position[1]] return position def nokia(str1): if str1[1:].isdigit() == False: return False if str1[0].isdigit() == True: return False return True for i in range(len(lines)): if lines[i] != "" and len(lines[i]) != 1 and len(lines[i]) < 4 and nokia(lines[i]): new.append(lines[i]) # print(new) P=[0,0] for item in new: P=edc(item,P) print('%d,%d'%(P[0],P[1]))