@@ -0,0 +1,1371 @@
+package leetcode;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Apublic class Task131 %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A        System.out.println(new Task131().partition(%22aab%22));%0A        System.out.println(new Task131().partition(%22bb%22));%0A    %7D%0A%0A    public List%3CList%3CString%3E%3E partition(String s) %7B%0A        if (s.isEmpty()) %7B%0A            return List.of();%0A        %7D%0A        if (s.length() == 1) %7B%0A            return List.of(List.of(s));%0A        %7D%0A        List%3CList%3CString%3E%3E results = new ArrayList%3C%3E();%0A        for (int i = 1; i %3C= s.length(); i++) %7B%0A            String head = s.substring(0, i);%0A            if (!isPalindrome(head)) %7B%0A                continue;%0A            %7D%0A            String tail = s.substring(i);%0A            if (tail.isEmpty()) %7B%0A                results.add(List.of(head));%0A                break;%0A            %7D%0A            for (List%3CString%3E parts : partition(tail)) %7B%0A                List%3CString%3E merged = new ArrayList%3C%3E();%0A                merged.add(head);%0A                merged.addAll(parts);%0A                results.add(merged);%0A            %7D%0A        %7D%0A        return results;%0A    %7D%0A%0A    private boolean isPalindrome(String s) %7B%0A        for (int i = 0; i %3C s.length() / 2; i++) %7B%0A            if (s.charAt(i) != s.charAt(s.length() - 1 - i)) %7B%0A                return false;%0A            %7D%0A        %7D%0A        return true;%0A    %7D%0A%7D%0A

Add Task131