#K48497. Palindromic Substrings Extraction
Palindromic Substrings Extraction
Palindromic Substrings Extraction
Given a string s consisting of lowercase English letters, extract all unique substrings that are palindromes. A palindrome is a string that reads the same forwards and backwards. The extracted palindromic substrings must be sorted first by their length (in increasing order) and then lexicographically.
For example, if the input is "abcbc", the palindromic substrings are: a b c bcb cbc
.
inputFormat
The input consists of a single line containing a string s composed only of lowercase English letters.
outputFormat
Print the unique palindromic substrings sorted first by their length and then lexicographically, separated by a single space. If the string is empty, print nothing.## sample
abcbc
a b c bcb cbc