```
def partition(self, s):
ret = []
self.dfs(s, 0, [], ret)
return ret
def dfs(self, s, index, cur, ret):
if index >= len(s):
ret.append(cur[::])
return
for i in range(index, len(s)):
temp = s[index:i+1]
cur.append(temp)
if temp == temp[::-1]:
self.dfs(s, i+1, cur, ret)
cur.pop()
```