← 返回 citadel 的题目列表Distinct Palindromic Substrings
类型:online_judge
Problem: Return All Distinct Palindromic Substrings
Given a string s, find all distinct non-empty palindromic substrings of s.
To make the output deterministic, print the distinct palindromic substrings in lexicographical order, one per line. The first line should contain the number of distinct palindromic substrings.
Input Format
One line containing the string s
Output Format
First line: an integer representing the number of distinct palindromic substrings
Following lines: each distinct palindromic substring in lexicographical order
Constraints
1 <= len(s) <= 2000
s contains only lowercase English letters
Example
Input:
ababa
Output:
5
a
aba
ababa
b
bab
Example
Input
a
Output
1
a