Remove duplicate elements from a list provided by user