human
I found an interesting problem on https://leetcode.com/problems/distinct-echo-substrings/:
Return the number of distinct non-empty substrings of text that can be written as the concatenation of some string with itself (i.e. it can be written as a + a where a is some string).
 
Example 1:
Input: text = "abcabcabc"
Output: 3
Explanation: The 3 substrings are "abcabc", "bcabca" and "cabcab".

Example 2:
Input: text = "leetcodeleetcode"
Output: 2
Explanation: The 2 substrings are "ee" and "leetcodeleetcode".

 
Constraints:

1 <= text.length <= 2000
text has only lowercase English letters.

I tried it in Python, but could not do it. Can you solve it?

 ... What is a the Python code you requested?
assistant
#Here is the Python code you requested.

class Solution:
    def distinctEchoSubstrings(self, text: str) -> int:
        def check(s):return s[:len(s)//2]==s[len(s)//2:]
        ret = set()
        n = len(text)
        for l in range(2,n+1,2):
            for start in range(n-l+1):
                s=text[start:start+l]
                if check(text[start:start+l]): ret.add(s)
        # print(ret)
        return len(ret)