<commit_before>Given a string s, partition s such that every substring of the partition is a palindrome.
Return all possible palindrome partitioning of s.
For example, given s = "aab",
Return
  [
    ["aa","b"],
    ["a","a","b"]
  ]
  
class Solution:
    # @param s, a string
    # @return a list of lists of string
    def partition(self, s):
        if len(s) == 0 or len(s) == 1:
            return [[s]]
        str_list = []
        result = []
        self.get_partition(s, str_list, result)
        return result
    
    def get_partition(self,s, str_list, result):
        if len(s) == 0:
            result.append(str_list)
            
        for i in xrange(1,len(s)+1):  # Note: here should be 1 to len(s) + 1
            substr = s[:i]
            if (self.is_palindrome(substr)):
                self.get_partition(s[i:], str_list + [substr], result)<commit_msg>Update Palindrome_Partitioning.py<commit_after>Given a string s, partition s such that every substring of the partition is a palindrome.
Return all possible palindrome partitioning of s.
For example, given s = "aab",
Return
  [
    ["aa","b"],
    ["a","a","b"]
  ]
  
class Solution:
    # @param s, a string
    # @return a list of lists of string
    def partition(self, s):
        if len(s) == 0 or len(s) == 1:
            return [[s]]
        str_list = []
        result = []
        self.get_partition(s, str_list, result)
        return result
    
    def get_partition(self,s, str_list, result):
        if len(s) == 0:
            result.append(str_list)
            
        for i in xrange(1,len(s)+1):  # Note: here should be 1 to len(s) + 1
            substr = s[:i]
            if (self.is_palindrome(substr)):
                self.get_partition(s[i:], str_list + [substr], result) 
                # Note: Here we pass str_list + [substr] instead of [str_list,substr]
{'fraction_non_alphanumeric': 0.12479914301017675, 'fraction_numerical': 0.007498660953401178, 'mean_word_length': 2.1500843170320403, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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}}
{'dir': 'git-commits-cleaned', 'id': '4417575', 'n_tokens_mistral': 613, 'n_tokens_neox': 593, 'n_words': 189}