let rec suitable h mask keys =
  match mask , keys with
    | m::ms , k::ks ->
        let c = String.compare m k in
        if c < 0 then suitable h ms keys else
          if c > 0 then suitable h mask ks else
            suitable (succ h) ms ks
    | _ -> h