Determine if a string has all the same characters: Difference between revisions

m
Line 1,567:
 
=={{header|J}}==
 
In J, <code>#~.y</code> gives a count of the unique items (characters) in y.
 
Here's a relatively concise (and grammatical) approach. For grammatical reasons we report the count of characters up through the differing character position, rather than its index:
6,962

edits