text of lowercase English letters. Cut it into non-empty consecutive pieces (gluing the pieces back in order gives the original string). No two pieces may be equal.
Return the largest possible number of pieces.text="xyxyzz" → 4
For instance, x | y | xy | z | z fails because z appears twice, while x | y | xy | zz works with 4 different pieces. Five is not achievable.
text="bbb" → 2
Only one piece can be b, so the best is b | bb.
text="q" → 1
text consists of lowercase English letterstext="xyxyzz"
4
Run checks the first 3 tests in your browser. Submit checks all 75 tests on the server, hidden ones included.