#include <iostream> #include <string> #include <vector> #include <stdlib.h> using namespace std; int main() { string str; vector<string> vec; cin >>str; string word; for(int i=0;i<str.length();i++){ if(str[i]==';'){ vec.push_back(word); word=""; }else word+=str[i]; } int left=0,right=0; for(auto iter=vec.begin();iter!=vec.end();++iter){ string s= *iter; //cout<<*iter<<endl; if(s.size()>3)continue; if(s[0]=='A'){ string in=""; in+=s[1]; in+=s[2]; if(s[1]>'9'||s[2]>'9')continue; int a=atoi(in.c_str()); left-=a;} if(s[0]=='D'){ string in=""; in+=s[1]; in+=s[2]; if(s[1]>'9'||s[2]>'9')continue; int a=atoi(in.c_str()); left+=a;} if(s[0]=='W'){ string in=""; in+=s[1]; in+=s[2]; if(s[1]>'9'||s[2]>'9')continue; int a=atoi(in.c_str()); right+=a;} if(s[0]=='S'){ string in=""; in+=s[1]; in+=s[2]; if(s[1]>'9'||s[2]>'9')continue; int a=atoi(in.c_str()); right-=a;} } cout<<left<<","<<right; } // 64 位输出请用 printf("%lld")