Magical String 1

Can you please help me proceed with the question. I understood what the question wants to say but finding it difficult to identify the recurrence.

@aman2382000
hello Aman,
this problem is very similar to LIS.

dp[i] = Number of ways to make partition when we are having only first i characters.

if we are at index i then from j=i to j=1 we will see whether this partition from | j…i is valid or not if it valid then dp[i]+=dp[j-1]

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.