how to print repeating elements in given array