One of the sample test case in the problem had the value of D to be 63 whose output was given out to be 12 peanutbutter. This sample is wrong as the number of distinct substrings of “peanutbutter” is 73 and the statement clearly stated -“when counting palindromic substrings, a substring that occurs multiple times should be counted multiple times.” Hence when we subtract all palindromic substrings the value of D must be 60.
I gave a lot of thought to the problem and was confused due to such case wherein they took only distinct palindromic substrings. I agree that we must obey what the statement states but such mistakes must be rectified as soon as possible and there must be an announcement regarding it. The sample case was updated quite late in the contest without giving any announcement.
I hope such mistakes are dealt with as soon as possible and in a better way in future.