If you enter a number 222246787

Calculated as 4 consecutive numbers

If you enter a number 342222267

Calculated is 5 consecutive

…….

Thinking of Seeking Code

1- set the current number to be currentNumber = false;

2- Set the number of consecutive occurrences of the current number to currentNumberTimes = 1;

3- set the maximum number of consecutive occurrences to maxTimes = 0;

4- Set the number corresponding to the maximum number of consecutive occurrences as maxTimesNumber = false;

5- convert the number into a character string, read each bit sequentially, and store the value of this bit into variable n

6- compare n with currentNumber, if consistent currentNumberTimes is added, otherwise:

6.1 Compare currentNumberTimes with maxTimes. If it is greater than MaxTimes, MaxTimes = CurrentNumberTimes; maxTimesNumber = currentNumber

6.2 currentNumber = n，currentNumberTimes = 1

7- maxTimesNumber is the desired number and maxTimes is the number of consecutive occurrences.

Note: If there are consecutive numbers of the same length, the value is the first, such as 111222, maxTimesNumber = 1, maxTimes = 3`$number = '43124321333334124233343223900'; $currentNumber = false; $currentNumberTimes = 1; $maxTimes = 0; $maxTimesNumber = false; for ($i = 0, $l = strlen($number); $i < $l; $i plus) $n = $number[$i]; if ($n === $currentNumber) { $ CurrentNumberTimesPlus; } else { if ($currentNumberTimes > $maxTimes) { $maxTimes = $currentNumberTimes; $maxTimesNumber = $currentNumber; bracket $currentNumberTimes = 1; $currentNumber = $n; bracket bracket Echo "number {$maxTimesNumber} appeared {$maxTimes} times in succession. \n"; //Number 3 appears five times in a row.`