programming test for microsoft interneship, number of distinct pallindromes in a given string