fork(1) download
  1. # from http://c...content-available-to-author-only...e.com/a/49665/31054
  2.  
  3. P=[1]
  4. for C in input().split():
  5. l,*Q=0,
  6. for p,c in zip(P,C):r=p*"\^/".find(c)/2;Q+=l+r,;l=p-r
  7. P=Q+[l]
  8. print(P)
  9.  
  10.  
Success #stdin #stdout 0.02s 8696KB
stdin
^ 
/^ 
^^/ 
/\/\ 
^^/^\ 
^\^\/^ 
\^^^\^/ 
stdout
[0.5, 0.5]