def wordBreak_TLE(self, s, dict):
        """
        TLE
        dfs
        O(n^2)
        Algorithm: DFS. The reason is that DFS repeatedly calculate whether a certain part of string can be segmented.
        Therefore we can use dynamic programming.

        :param s: a string
        :param dict: a set of string
        :return: a boolean
        """
        string_builder = ""
        if s=="":
            return True

        # greedy
        for i in range(len(s)):
            string_builder += s[i]
            if string_builder in dict:
                try:
                    if self.wordBreak_TLE(s[i+1:], dict):
                        return True
                    else:
                        continue
                except __HOLE__:
                    return True

        return False
dataset/ETHPy150Open algorhythms/LeetCode/139 Word Break.py/Solution.wordBreak_TLE