#include <iostream> #include<vector> #include<string> using namespace std; int main() { string line; while (getline(cin,line)) { // 注意 while 处理多个 case int a=0, b=0; vector<string>cor;string temp; for(char c:line) { if(c!=';') temp+=c; else { if(!temp.empty()&&1<temp.size()&&temp.size()<=3) cor.emplace_back(temp); temp=""; } } for(string m:cor) {char i=m[0]; string j=m.substr(1); if(j[0]<'0'||j[0]>'9') continue; if(j.size()==2&&(j[1]<'0'||j[1]>'9')) continue; int step=stoi(j); if(i=='A') a-=step; else if(i=='D') a+=step; else if(i=='W') b+=step; else if(i=='S') b-=step; } cout << a <<"," <<b << endl; } return 0; } // 64 位输出请用 printf("%lld")