I have a dilemma on my hands. After much trial and error, I still could not understand this simple task.
I have one array
String [] array = {anps, anps, anps, bbo, ehllo};
I need to be able to go through an array and find duplicates and print them on one line. Words without duplicates should be displayed separately
The output should be like this:
anps anps anps bbo ehllo
I tried while, for loops, but logic seems impossible.
source share