<jupyter_start><jupyter_text><jupyter_code>class Solution:
    def longestDecomposition(self, text: str) -> int:
        ans = 0
        left, right = 0, len(text) - 1
        left_str = ''
        right_str = ''
        while left <= right:
            left_str += text[left]
            right_str += text[right]
            if left_str == right_str:
                left_str = ''
                right_str = ''
                if left == right:
                    ans += 1
                else:
                    ans += 2
            left += 1
            right -= 1
        if left_str and right_str:
            ans += 1
        return ans 
solution = Solution()
solution.longestDecomposition("aaa")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10054347826086957, 'fraction_numerical': 0.010869565217391304, 'mean_word_length': 1.3396825396825396, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '432636', 'license': 'Apache-2.0', 'n_tokens_mistral': 225, 'n_tokens_neox': 205, 'n_words': 51, 'path': 'Dynamic Programming/1204/1147. Longest Chunked Palindrome Decomposition.ipynb', 'repo_name': 'YuHe0108/Leetcode', 'size': '736'}