| Conditions | 6 |
| Total Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | from collections import Counter |
||
| 4 | def long_repeat(line): |
||
| 5 | # length the longest substring that consists of the same char |
||
| 6 | if len(line) >= 2: |
||
| 7 | slice_index = [index for index, value in enumerate(line[:-1]) |
||
| 8 | if value != line[index + 1]] |
||
| 9 | values = [slice_index[index + 1] - value |
||
| 10 | for index, value in enumerate(slice_index[:-1])] |
||
| 11 | if values: |
||
| 12 | return max(values) |
||
| 13 | return len(line) |
||
| 14 | |||
| 24 |