Dsa
Dynamic Programming
Easy
Palindrome Partitioning Count
Given a string `s`, your task is to count how many ways the string can be partitioned into substrings such that each substring is a palindrome. Implement a function that reads the string from standard input and prints the count of valid palindrome partitions.
Input format:
- A single line containing the string `s` (1 ≤ |s| ≤ 100).
Output format:
- Print a single integer, the number of ways to partition the string into palindromic substrings.
Example:
Input:
aba
Output:
2
(The two partitions are: ['a', 'b', 'a'] and ['aba'].
Key concepts
dynamic_programmingstringcounting
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now