The core idea is maintaining a counter that tracks how many identical characters you've seen in a row.
For the string "0001111111", you start with count 1 for the first 0. You see another 0, so count becomes 2, then 3.
Then you see six more 1s, bringing count to 7. You check if count reaches 7 at any point during the scan. If it does, you can immediately output YES and stop.