import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
int n0 = 0;
for(int p=0;p<str.length();p++){
if(str.charAt(p)==';'){
n0++;
}
}
String[] s = new String[n0];
s = str.split(";");
int[] n = {0,0};
for(int i=0;i<n0;i++){
String r = s[i];
String num=null;
boolean b = false,c = false;
int count = 0;
if(r.length()>1){
num = r.substring(1);
for(int j=0;j<num.length();j++){
if(!(num.charAt(j)<='9'&&num.charAt(j)>='0')){
b = false;
break;
}else{
b = true;
}
}
}else{
b = false;
}
if(r.length()>1){
c = true;
}
if(b&&c){
count = Integer.parseInt(num);
n[0]+=get(r.charAt(0),count)[0];
n[1]+=get(r.charAt(0),count)[1];
}
}
sc.close();
System.out.println(n[0]+","+n[1]);
}
public static int[] get(char c,int n5) {
int[] n7 = new int[2];
if(c=='A'){
n7[0] -= n5;
}
if(c=='S'){
n7[1] -= n5;
}
if(c=='W'){
n7[1] += n5;
}
if(c=='D'){
n7[0] += n5;
}
return n7;
}
}
网友评论