added fn to count unique chars