For an explanation,refer to the soluytion submitted by Larryin the comment section
blackjack
flooble's webmaster puzzle