Brian Kernighan’s Algorithm