  Braid combing is a procedure defined by Emil Artin to solve the word problem
in braid groups for the first time. It is well-known to have exponential
complexity. In this paper, we use the theory of straight line programs to give
a polynomial algorithm which performs braid combing. This procedure can be
applied to braids on surfaces, providing the first algorithm (to our knowledge)
which solves the word problem for braid groups on surfaces with boundary in
polynomial time and space.
  In the case of surfaces without boundary, braid combing needs to use a
section from the fundamental group of the surface to the braid group. Such a
section was shown to exist by Gon\ccalves and Guaschi, who also gave a
geometric description. We propose an algebraically simpler section, which we
describe explicitly in terms of generators of the braid group, and we show why
the above procedure to comb braids in polynomial time does not work in this
case.
