fork download
  1. I=input
  2. a,b,D=I().split(',')
  3. w='ENWS'
  4. d=w.find(D)
  5. x=int(a)+int(b)*1j
  6. for c in I():x+=(c=='M')*1j**d;d+='ML'.find(c)
  7. print(x.real,x.imag,w[d%4])
Success #stdin #stdout 0.03s 9440KB
stdin
1,2,N
MRMLM
stdout
2.0 4.0 N