Find duplicates in sequences of strings

See Robby Pelssers Blog
In this version the data is a sequence of strings rather than integers.

1. Setup test data

The test data is regenerated for each script so the outputs are not the same.

3. Distinct Values2

as suggested by Michael Westbay

5. count

6. group

as suggested by Wolfgang - requires XQuery 3.0.