How does using the Counter class from collections help in removing duplicates?
Counter can count occurrences and help in removing duplicates by keeping only elements with a count of one.