import sys
class PositionActor():
def init(self, moving_str):
self.moving = moving_str
self.position = [0, 0]
self.action = ['a', 'd', 'w', 's']
def go_left(self, moving): self.position[0] -= moving def go_right(self, moving): self.position[0] += moving def go_up(self, moving): self.position[1] += moving def go_down(self, moving): self.position[1] -= moving def run_moving(self): all_steps = self.moving.split(';') for per_step in all_steps: if len(per_step) == 0: continue if len(per_step) > 3: print(per_step) continue if per_step[0].lower() not in self.action: continue if per_step[1:].isdigit(): moving = int(per_step[1:]) else: continue if per_step[0].lower() == 'a': self.go_left(moving) elif per_step[0].lower() == 'd': self.go_right(moving) elif per_step[0].lower() == 'w': self.go_up(moving) elif per_step[0].lower() == 's': self.go_down(moving)
def main():
while True:
all_steps = sys.stdin.strip()
if all_steps == '':
break
action_instance = PositionActor(all_steps)
action_instance.run_moving()
print(action_instance.position[0], end=',')
print(action_instance.position[1])
main()