`{"id":"763c6f7f-de5a-41f2-b483-a2e0ba04448c","name":"All Palindromic Partitions","description":"1. You are given a string of length n.\r\n2. You have to partition the given string in such a way that every partition is a palindrome.\r\n\r\nNote -> Check out the question video and write the recursive code as it is intended without \r\n changing signature. The judge can't force you but intends you to teach a concept.","inputFormat":"A String of length n","outputFormat":"Check the sample ouput and question video.","constraints":"1 &lt;= length of string &lt;= 15","sampleCode":{"cpp":{"code":"#include <iostream>\nusing namespace std;\n\nvoid solution(string str, string asf)\n{\n\t\t//write you code here\n}\n\nint main() \n{\n string str; \n cin>>str;\n solution(str,\"\");\n return 0;\n}"},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n\tpublic static void solution(String str, String asf) {\r\n\t\t//write you code here\r\n\t\t\r\n\t}\r\n\tpublic static void main(String[] args) {\r\n\t\tScanner scn = new Scanner(System.in);\r\n\t\tString str = scn.nextLine();\r\n\t\tsolution(str, \"\");\r\n\t}\r\n\r\n}"},"python":{"code":""}},"points":10,"difficulty":"medium","sampleInput":"pep","sampleOutput":"(p) (e) (p) \r\n(pep) \r\n","questionVideo":"https://www.youtube.com/embed/wvaYrOp94k0?end=68","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"082986ae-d618-4a59-9ab3-6d79056679a4","name":"Recursion and Backtracking For Intermediate","slug":"recursion-and-backtracking-for-intermediate-330","type":0},{"id":"c9938b97-4f0f-407a-b722-fc343a43bcdd","name":"All Palindromic Partitions","slug":"all-palindromic-partitions","type":1}],"next":{"id":"df1ffdc8-cb54-4757-9f11-a9682e223fb0","name":"All Palindromic partitions MCQ","type":0,"slug":"all-palindromic-partitions-mcq-2exps"},"prev":{"id":"9b11fb43-ae7b-4192-a64a-c89e9ad7b62f","name":"k-Partitions MCQ","type":0,"slug":"k-partitions-mcq"}}}`

# All Palindromic Partitions

1. You are given a string of length n. 2. You have to partition the given string in such a way that every partition is a palindrome. Note -> Check out the question video and write the recursive code as it is intended without changing signature. The judge can't force you but intends you to teach a concept.

`{"id":"763c6f7f-de5a-41f2-b483-a2e0ba04448c","name":"All Palindromic Partitions","description":"1. You are given a string of length n.\r\n2. You have to partition the given string in such a way that every partition is a palindrome.\r\n\r\nNote -> Check out the question video and write the recursive code as it is intended without \r\n changing signature. The judge can't force you but intends you to teach a concept.","inputFormat":"A String of length n","outputFormat":"Check the sample ouput and question video.","constraints":"1 &lt;= length of string &lt;= 15","sampleCode":{"cpp":{"code":"#include <iostream>\nusing namespace std;\n\nvoid solution(string str, string asf)\n{\n\t\t//write you code here\n}\n\nint main() \n{\n string str; \n cin>>str;\n solution(str,\"\");\n return 0;\n}"},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n\tpublic static void solution(String str, String asf) {\r\n\t\t//write you code here\r\n\t\t\r\n\t}\r\n\tpublic static void main(String[] args) {\r\n\t\tScanner scn = new Scanner(System.in);\r\n\t\tString str = scn.nextLine();\r\n\t\tsolution(str, \"\");\r\n\t}\r\n\r\n}"},"python":{"code":""}},"points":10,"difficulty":"medium","sampleInput":"pep","sampleOutput":"(p) (e) (p) \r\n(pep) \r\n","questionVideo":"https://www.youtube.com/embed/wvaYrOp94k0?end=68","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"082986ae-d618-4a59-9ab3-6d79056679a4","name":"Recursion and Backtracking For Intermediate","slug":"recursion-and-backtracking-for-intermediate-330","type":0},{"id":"c9938b97-4f0f-407a-b722-fc343a43bcdd","name":"All Palindromic Partitions","slug":"all-palindromic-partitions","type":1}],"next":{"id":"df1ffdc8-cb54-4757-9f11-a9682e223fb0","name":"All Palindromic partitions MCQ","type":0,"slug":"all-palindromic-partitions-mcq-2exps"},"prev":{"id":"9b11fb43-ae7b-4192-a64a-c89e9ad7b62f","name":"k-Partitions MCQ","type":0,"slug":"k-partitions-mcq"}}}`

Editor

# All Palindromic Partitions

medium

1. You are given a string of length n. 2. You have to partition the given string in such a way that every partition is a palindrome. Note -> Check out the question video and write the recursive code as it is intended without changing signature. The judge can't force you but intends you to teach a concept.

## Constraints

1 <= length of string <= 15

## Format

### Input

A String of length n

### Output

Check the sample ouput and question video.

## Example

Sample Input

`.css-23h8hz{color:inherit;font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;}pep`

### Sample Output

```.css-3oaykw{color:var(--chakra-colors-active-primary);font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;font-family:Monospace;}(p) (e) (p) (pep) ```

Question Video

Discussions

Show Discussion

Related Resources