#include <stdio.h> #include <string.h> int x = 0, y = 0; void like(char* str) { int num = strlen(str); if (num > 3 || num <= 1) return; else { if ((str[0] == 'A' && str[1] >= '0' && str[1] <= '9' && str[2] == 0) || (str[0] == 'A' && str[1] >= '0' && str[1] <= '9' && str[2] >= '0' && str[2] <= '9')) { if (str[2]) x = x - ((str[1] - '0') * 10 + str[2] - '0'); else x = x - str[1] + '0'; } if ((str[0] == 'D' && str[1] >= '0' && str[1] <= '9' && str[2] == 0) || (str[0] == 'D' && str[1] >= '0' && str[1] <= '9' && str[2] >= '0' && str[2] <= '9')) { if (str[2]) x = x + ((str[1] - '0') * 10 + str[2] - '0'); else x = x + str[1] - '0'; } if ((str[0] == 'S' && str[1] >= '0' && str[1] <= '9' && str[2] == 0) || (str[0] == 'S' && str[1] >= '0' && str[1] <= '9' && str[2] >= '0' && str[2] <= '9')) { if (str[2]) y = y - ((str[1] - '0') * 10 + str[2] - '0'); else y = y - str[1] + '0'; } if ((str[0] == 'W' && str[1] >= '0' && str[1] <= '9' && str[2] == 0) || (str[0] == 'W' && str[1] >= '0' && str[1] <= '9' && str[2] >= '0' && str[2] <= '9')) { if (str[2]) y = y + ((str[1] - '0') * 10 + str[2] - '0'); else y = y + str[1] - '0'; } } } int main(void) { char str[10000]; char str1[1000]; while (scanf("%s", str) != EOF) { x = 0; y = 0; int num = strlen(str); int j = 0; for (int i = 0; i < num; i++) { if (str[i] == ';') { str1[j] = 0; like(str1); j = 0; continue; } str1[j] = str[i]; j++; } printf("%d,%d\r\n", x, y); } return 0; }