Determining word palindrome count and word substrings set