Given a string, find all possible palindromic partitions of given string.
Note that this problem is different from Palindrome Partitioning Problem, there the task was to find the partitioning with minimum cuts in input string. Here we need to print all possible partitions.
The idea is to go through every substring starting from first character, check if it is palindrome. If yes, then add the substring to solution and recur for remaining part. Below is complete algorithm.
Below is the implementation of above idea.
n i t i n n iti n nitin
This article is contributed by Ekta Goel. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Print all palindromic partitions of a string
- Print all possible palindromic string formed using any pair of given strings
- Minimum cuts required to convert a palindromic string to a different palindromic string
- Make palindromic string non-palindromic by rearranging its letters
- Print all the palindromic permutations of given string in alphabetic order
- Lengths of maximized partitions of a string such that each character of the string appears in one substring
- Maximized partitions of a string such that each character of the string appears in one substring
- Largest palindromic string possible from given strings by rearranging the characters
- Longest Palindromic Substring using Palindromic Tree | Set 3
- Sum of elements of all partitions of number such that no element is less than K
- Generate all unique partitions of an integer | Set 2
- Print the longest palindromic prefix of a given string
- Print all possible combinations of the string by replacing '$' with any other digit from the string
- Longest palindromic string possible after removal of a substring
- Find all distinct palindromic sub-strings of a given string
- Count All Palindromic Subsequence in a given String
- Find all palindromic sub-strings of a given string | Set 2
- Lexicographically all Shortest Palindromic Substrings from a given string
- Find a palindromic string B such that given String A is a subsequense of B
- Make a palindromic string from given string