fork download
  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<math.h>
  4. int main(){char c,*C="NWSE-WN";float x,y,d,k=M_PI/2;scanf("%f,%f,%c",&x,&y,&c);d=(strchr(C,c)-C)*k;do{switch(getchar()){case'R':d+=k;break;case'L':d-=k;break;case'M':x+=sin(d);y+=cos(d);break;case EOF:printf("%g,%g,%c\n",x,y,C[(int)(sin(d)+2*cos(d)+4.5)]);}}while(!feof(stdin));return 0;}
Success #stdin #stdout 0s 2296KB
stdin
1,2,N MRMLM
stdout
2,4,N