K, your code:

function a($b)
  dim $c,$,$d,$!
  $=join(split($b,_),$)
  while $
    $d=$c<'/'
    $c=$
    $=right($,~)
    $d=$d+($<'/')
    $!=$!+iif($c>_,$d,2*($c<'/'|$c<_&$d))
  ; loop
  $a=$!*50/($b^)
endfunction

doesn't return anything for test cases 4 and 9 because it never enters the loop... the join(split($b,_),$) renders $ empty as there are only _ characters ;\)

Dale's adaption on the other hand returns a 0 as it calculates even if $ gets emptied in the second function.

Clear?

edit: I had this in the make too :roll:


Edited by Jochen (2007-10-16 09:01 AM)
_________________________