Using you language of choice, write the shortest function/script/program you can that will identify the word with the highest number of unique letters in a text.
- Unique letters should include any distinct character using UTF-8 encoding.
- Upper and lower case versions of the same character are different and distinct;
'a' != 'A'
- Upper and lower case versions of the same character are different and distinct;
- Words are bound by any whitespace character.
- 'Letters' are any symbol which can be represented by a single unicode character.
- The text document must be read in by your code -- no preloading/hard-coding of the text allowed.
- The output should be the word, followed by the count of unique letters.
llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch - 18
- Any delimiter/spacing between the two values is up to you, so long as there is at least one character to separate them.
- In the event more than one word exists with the highest count, print all words for that count, with one new line delimiting.
superacknowledgement - 16 pseudolamellibranchiate - 16
- This is code golf, so shortest code wins.
This answer on English.SE inspired me to create this challenge. The example uses just a word list, but any text should be able to be processed.
LlanfairPG
is a Welsh word and contains letters from the Welsh alphabet -ll
andch
are both single letters in the Welsh language. \$\endgroup\$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+~`<>/\\?'";:{}[],.
is a valid "word"? \$\endgroup\$