let is_subseq s t = let i = ref 0 in let n = String.length s in let m = String.length t in let j = ref 0 in while !i < n && !j < m do if s.[!i] = t.[!j] then i := !i + 1; j := !j + 1 done; !i = n ;; (if is_subseq "abc" "ahbgdc" then 1 else 0) + (if is_subseq "axc" "ahbgdc" then 1 else 0) + (if is_subseq "" "anything" then 1 else 0) + (if is_subseq "abc" "abc" then 1 else 0) + (if is_subseq "abcd" "abc" then 1 else 0)