Edit: I notice that it is possible to use hashset to stop duplicate elements, however, I don\'t think using that can count the duplicate elements, please correct me if I am