This problem would have been a classical problem if the memory limits would not have been that tight. In the classical version we can use DP or the LCS with O(n^2) memory but this problem requires O(n) memory.
How to go about it?
I searched the solution of this problem online but found only codes and not the solution.
This problem is similar to [SPOJ]AIBOHP except the memory limit of 16 MB. Solution having O(N2) memory complexity will exceed memory limit. So, we need to solve this problem less than O(N2) memory complexity i.e O(N), O(NlogN).
Answer = N - (LCS length of the given string and it's reverse)