Skip to main content

Palindromic Substrings

Challenge on lesson: Checkpoint — Strings

CHALLENGE
Difficulty: intermediate+25 XP

**Description:** Count the substrings of s that are palindromes. Occurrences at different positions count separately: aaa has 6 (three a, two aa, one aaa). **Input:** One line: s (1 <= |s| <= 1000, lowercase letters). **Output:** One integer — the number of palindromic substrings. **Example:** abba -> 6 (a, b, b, a, bb, abba).

Back to lesson: Checkpoint — Strings