indicate_duplicates function

Determine duplicate elements including their first occurrence.