Update unique algo to not cheat.

The previous algorithm took advantage of join()'s behavior of removing
null entries in an array. If we were really using an in-place character
array (like in c or java) this wouldn't work.