[Solved] printing the duplicates characters in a line with same characters [closed]
You need to ensure input is sorted first, i.e. with Arrays.sort(). Once it is you can loop over the input and print each character. Whenever the next character is different print a new line. Another alternative would be to create some kind of storage of counts of each character, e.g. LinkedHashMap(), but that would be … Read more