A partition of a string $s$ is a set of one or more non-overlapping non-empty substrings of $s$ (call them $a_1,a_2,a_3,...,a_d)$, such that $s$ is their concatenation: $s = a_1+a_2+a_3+...+a_d$. We call these substrings "chunks" and define the length of such a partition to be the number of chunks, $d$.
We can represent the partition of a string by writing each chunk in parentheses. For example, the string "decode" can be partitioned as(d)(ec)(ode)or(d)(e)(c)(od)(e)or(decod)(e)or(decode)or(de)(code)or a number of other ways.
A partition is palindromic if its chunks form a palindrome when we consider each chunk as an atomic unit. For example, the only palindromic partitions of "decode" are(de)(co)(de)and(decode). This also illustrates that every word has a trivial palindromic partition of length one.
Your task is to compute the maximal possible number of chunks in palindromic partition.