text and a positive integer min_len. Choose several non-overlapping substrings (contiguous pieces) of the string so that each one is a palindrome, reading the same forwards and backwards, and has length at least min_len.
Return the largest number of substrings you can choose.text="levelxnoonyy", min_len=3 → 2
"level" and "noon" work: both are palindromes of length at least 3 and they do not overlap. "yy" is too short.
text="aaaa", min_len=2 → 2
The string splits into "aa" and "aa".
text="abcd", min_len=2 → 0
text consists of lowercase English letterstext="levelxnoonyy", min_len=3
2
Run checks the first 3 tests in your browser. Submit checks all 111 tests on the server, hidden ones included.