Determine if all characters in a string are the same

c#, contains, string

Solution

return (ssn.Distinct().Count() == 1)

Problem

I have a situation where I need to try and filter out fake SSN numbers. From what I've seen so far if they are fake they're all the same number or 123456789. I can filter for the last one, but is there an easy way to determine if all the characters are the same?

Original source

Related problems