Suppose we have a string s. We have to check whether the given string is colindrome or not. The colindrome is a concatenated string of 6 length palindromes.
So, if the input is like s = "aabbaamnoonm", then the output will be True as this contains palindromes like "aabbaa" and "mnoonm", both are of length 6.
To solve this, we will follow these steps −
Let us see the following implementation to get better understanding −
def is_palindrome(s): return s == s[::-1] def solve(s): if len(s) % 6 != 0: return False for i in range(0, len(s), 6): if not is_palindrome(s[i : i+6]): return False return True s = "aabbaamnoonm" print(solve(s))