  We count a large class of lattice paths by using factorizations of free
monoids. Besides the classical lattice paths counting problems related to
Catalan numbers, we give a new approach to the problem of counting walks on the
slit plane (walks avoid a half line) that was first solved by
Bousquet-M\'{e}lou and Schaeffer. We also solve a problem about walks in the
half plane avoiding a half line by subsequently applying the factorizations of
two different Gessel pairs, giving a generalization of a result of
Bousquet-M\'{e}lou.
