Dsa
Strings
Medium
Palindromic Substring Count
Write a function that counts how many unique substrings of a given string are palindromes. A substring is defined as a contiguous sequence of characters within the string. The same palindromic substring counted multiple times should only be counted once.
Input:
- A single line string containing only lowercase alphabets.
Output:
- An integer representing the number of unique palindromic substrings.
Example:
Input:
racecar
Output:
7
Key concepts
stringssubstringpalindrome
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