#include <stdio.h> #include <string.h> int cor[2]={0}; int x,y=0; //x轴,y轴坐标 char word='\0'; char list[2000]={'\0'}; char space[10]={'\0'}; char legal[]={'A','D','S','W'}; int step,sbit,gbit=0; int i,j,k,m,len,len2=0; void move(char wd,int stp) { if(wd=='A') x-=stp; if(wd=='D') x+=stp; if(wd=='S') y-=stp; if(wd=='W') y+=stp; } int main() { gets(list); len=strlen(list); for(i=0;i<len;i++) { if((list[i]==';')&&(list[i-4]==';'||list[i-4]==NULL)) { for(k=0; k<3; k++) { space[k]=list[i-3+k]; } for(m=0;m<4;m++) { if(space[0]==legal[m]) { if((space[1]>='0')&&(space[1]<='9')) { if((space[2]>='0')&&(space[2]<='9')) { word=space[0]; sbit=(int)(space[1]-'0'); gbit=(int)(space[2]-'0'); step=10*sbit+gbit; move(word,step); sbit=0;gbit=0; } } } } } if((list[i]==';')&&(list[i-3]==';'||list[i-3]==NULL)) { for(k=0; k<2; k++) { space[k]=list[i-2+k]; } for(m=0;m<4;m++) { if(space[0]==legal[m]) { if((space[1]>='0')&&(space[1]<='9')) { word=space[0]; gbit=(int)(space[1]-'0'); step=gbit; move(word,step); gbit=0; } } } } } printf("%d,%d\n",x,y); return 0; }