Jelly, (削除) 18 16 (削除ここまで) 15 bytes
I%5Œg%8ċ1ドルṀμÐṀḢ
A monadic link taking a list of lists of digits, and returning the leftmost one containing a maximal run as described.
Try it online! or see a test suite (with processing to make I/O look like it is in the question).
How?
I%5Œg%8ċ1ドルṀμÐṀḢ - Link: list of lists of integers (digits) from [0-9]
μÐṀ - keep elements for which the link to the left is maximal:
I - incremental differences (i.e. [a2-a1, a3-a2, ...])
5 - literal 10
% - modulo by (i.e. [(a2-a1)%10, (a3-a2)%10, ...])
- this equates deltas of -9 and -1 with 1 and 9 respectively
Œg - group runs of equal elements
%8 - modulo by 8; vectorised (9s become 1s, others unaffected)
ċ1ドル - count number of 1s in €ach group
Ṁ - maximum
Ḣ - head (get the first one of those that were maximal)
Jonathan Allan
- 115.4k
- 8
- 68
- 293