#C14952. Palindromic Substrings Extraction

    ID: 44658 Type: Default 1000ms 256MiB

Palindromic Substrings Extraction

Palindromic Substrings Extraction

You are given a string s. Your task is to extract all of its palindromic substrings.

A palindrome is a string that reads the same forwards and backwards. In other words, a string t is a palindrome if it satisfies the condition \[ t = t^R \] where \(t^R\) denotes the reverse of t.

A substring is a contiguous sequence of characters within a string. You must consider every possible substring of s and print it if it is a palindrome.

The palindromic substrings should be output in the order they are encountered: i.e. for every starting index i (from 0 to \(n-1\)) and every ending index j (from i to \(n-1\)), if the substring s[i..j] is a palindrome, then output it.

inputFormat

The input consists of a single line containing the string s. The string can be empty or non-empty and may contain any printable characters.

outputFormat

Output all palindromic substrings found in the string, separated by a single space. There should be no extra spaces at the beginning or end of the output.

## sample
a
a