text. Cut it into contiguous pieces so that each piece is even. Return the smallest possible number of pieces.text="aabbcab" → 2
For example, "aabb" + "cab": the first piece has two a's and two b's, the second one of each of c, a and b. The whole string fails: three a's and b's but a single c.
text="xyzzyx" → 1
Each letter appears exactly twice, so the whole string is one piece.
text="aab" → 2
"aab" itself is uneven, but "a" + "ab" works: two pieces.
text consists of lowercase English letterstext="aabbcab"
2
Run checks the first 3 tests in your browser. Submit checks all 75 tests on the server, hidden ones included.