Given a string, write a code to count all palindrome sub string in a given string. Length of palindrome sub string is greater than or equal to 2.
entered_list = input("Enter a list, separating words with spaces: ").split()
test_list = list(map(str, entered_list))
res = [element for element in test_list if str(element)[::-1] in test_list]
print(len(res))
Comments
Leave a comment