#K48052. Palindrome Permutations

    ID: 28334 Type: Default 1000ms 256MiB

Palindrome Permutations

Palindrome Permutations

Given a string s, output all unique palindromic permutations of s in lexicographical order. If no palindromic permutation exists, print No palindromes found.

A string is called a palindrome if it reads the same backward as forward. For example, "abba" and "aba" are palindromes.

Note: The input will be a single string read from standard input and the output should be printed to standard output. Each valid palindrome must be printed on a new line.

Examples:

  • If s = "aabb", the output should be:
    abba
    baab
  • If s = "abc", the output should be:
    No palindromes found

inputFormat

The input consists of a single line containing the string s.

outputFormat

If one or more palindromic permutations exist, output each permutation in lexicographical order on separate lines. Otherwise, output a single line: No palindromes found.

## sample
aabb
abba

baab

</p>