It is 20.

If all possibilities were valid: 2^5 = 32 different plays: WWWWW, WWWWL, WWWLW, WWWLL, â€¦., LLLLW, LLLLL.

If the man wins in 3 consecutive plays: WWW??, gets 5$ and stops, we loose 2^2=4 possibilities, so we count 1 instead of 4.

If the man looses in 2 consecutive plays: LL???, we loose 2^3=8, so we count 1 way for LLL, but loose 8 .

So far: 32-3-7= 22

Now there are other plays where we get to 0$ before playing the 5th time: LWLL (we loose 2 possibilities, nett:1way), and WLLL (nett: 1 way). 22-2 = 20 ways.

My problem is that I got to 22 quite easily, but to get to the other dead ends I had to draw the tree.

I hope somebody can help furtherâ€¦