solving uniqCharacter with reduce