The while loop is treating the `current` and `next` variables in the opposite way. Once this is fixed, the while loop should check for `next`, not `current`.
The while loop is treating the
currentandnextvariables in the opposite way. Once this is fixed, the while loop should check fornext, notcurrent.