#K89237. Palindromic Substrings Finder
Palindromic Substrings Finder
Palindromic Substrings Finder
You are given a string s. Your task is to find all palindromic substrings in s. A substring is defined as a consecutive sequence of characters inside the string. A palindrome is a string that reads the same forwards and backwards. In other words, a string t is a palindrome if it satisfies $$t = \text{reverse}(t)$$.
The order in which the palindromic substrings are output should follow the order in which they are identified by the algorithm:
- Every individual character is considered a palindrome.
- Palindromic substrings of length 2 and more are determined using dynamic programming.
Examples:
Input: abba Output: a b b a bb abba</p>Input: abc Output: a b c
inputFormat
The input consists of a single line containing a non-empty string s. The string contains only printable characters.
You should read the input from standard input stdin
.
outputFormat
Output all palindromic substrings found in the string s in one line, separated by a single space. Print the result to standard output stdout
.
abba
a b b a bb abba