Showing unique characters in a string only once
问题 I have a string with repeated letters. I want letters that are repeated more than once to show only once. For instance I have a string aaabbbccc i want the result to be abc. so far my function works like this: if the letter doesn't repeat, it's not shown if it's repeated once, it's show only once (i.e. aa shows a) if it's repeated twice, shows all (i.e. aaa shows aaa) if it's repeated 3 times, it shows 6 (if aaaa it shows aaaaaa) function unique_char(string) { var unique = ''; var count = 0;