Normal palindrome is defined as a string that reads the same backwards as forwards, for example "abccba". Chunked palindrome is defined as a string that you can split into chunks and it will form a palindrome. For example, "volvo". You can split it into (vo)(l)(vo). Let A = "vo", B = "l", so the original string is ABA which is a palindrome.
Given a string str, find the maximum number of chunks we can split that string to get a chuncked palindrome.
:- "aaaaaa", output is 6 ((a)(a)(a)(a)(a)(a))
:- "volvol" output is 2 ((vol)(vol))
Length of string <=2*(10^4)
I can think of a greedy way to solve this problem but not able to prove if it's optimal.