Popular recipes by David Lambert http://code.activestate.com/recipes/users/4169769/2010-01-16T11:21:15-08:00ActiveState Code RecipesPalindrome count (Python)
2010-01-16T11:21:15-08:00David Lamberthttp://code.activestate.com/recipes/users/4169769/http://code.activestate.com/recipes/577010-palindrome-count/
<p style="color: grey">
Python
recipe 577010
by <a href="/recipes/users/4169769/">David Lambert</a>
(<a href="/recipes/tags/palindrome/">palindrome</a>).
</p>
<p>'abccdadba' contains 50 palindromes, not all unique. Examples are:
'a' at positions 0,-4, and -1.
'aa' at (0,4),(5,-1), and (5,-1)
The longest is 'abdadba'
This code counts the palindromes in the data variable.</p>