import java.util.*;
@SuppressWarnings("unchecked")
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
List<String> list=new ArrayList();
while(sc.hasNext()){
String str=sc.nextLine();
String[] array=str.split(";");
for(String s:array){
if(s.matches("[ADWS][0-9]{1,2}")){
list.add(s);
}
}
}
int x=0;
int y=0;
for(String s:list){
if(s.startsWith("A")){
x=x-Integer.valueOf(s.substring(1));
}else if(s.startsWith("D")){
x=x+Integer.valueOf(s.substring(1));
}else if(s.startsWith("W")){
y=y+Integer.valueOf(s.substring(1));
}else if(s.startsWith("S")){
y=y-Integer.valueOf(s.substring(1));
}
}
System.out.print(x+","+y);
}
@SuppressWarnings("unchecked")
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
List<String> list=new ArrayList();
while(sc.hasNext()){
String str=sc.nextLine();
String[] array=str.split(";");
for(String s:array){
if(s.matches("[ADWS][0-9]{1,2}")){
list.add(s);
}
}
}
int x=0;
int y=0;
for(String s:list){
if(s.startsWith("A")){
x=x-Integer.valueOf(s.substring(1));
}else if(s.startsWith("D")){
x=x+Integer.valueOf(s.substring(1));
}else if(s.startsWith("W")){
y=y+Integer.valueOf(s.substring(1));
}else if(s.startsWith("S")){
y=y-Integer.valueOf(s.substring(1));
}
}
System.out.print(x+","+y);
}
}
答案二: