すべてのパターン分けをしましたが、もっと良い解き方があると思います。 https://github.com/kaznum/programming_in_ocaml_exercise/blob/master/ex6.2/overlap.ml