I'm trying to write a function that works like
"aaaabbccccdeeeaaaaa"
--> "abcdea"
but I can't figure out how to actually remove characters from the string. So where I'm at is
String.prototype.removeConsecutives = function()
{
let k = 0;
for(int i = 0; i < this.length; ++i)
if(this[i] !== this[i-1])
this[k++] = this[i];
// now I want to remove the characters in the range
// of indices [k, this.length)
}