I’m trying to check if a string contains more than two repeating characters.
for example
'aabcd123' = ok
'aaabcd123' = not ok
'aabbab11!@' = ok
'aabbbac123!' = not ok
I’ve tried something like this but with no luck
if (string.Distinct().Count() > 2){
//do something
}
any help would be appreciated.
This one worked for me: