Concatenation of Three Palindromes#8251

Concatenation of Three Palindromes

1 Sekunde
256 Megabyte
Schwer

Given a string of length , determine whether can be expressed as a concatenation of three palindromes.

Eingabe

The first line contains a natural number (n \leq 10000). The second line contains the string (|s| = n).

Ausgabe

If the string cannot be represented as a concatenation of three palindromes, output "NO". Otherwise, print "YES" on the first line, and on the next line print the three palindromes, separated by spaces, whose concatenation forms . If there are multiple solutions, any valid set of palindromes can be provided.

Beispiele

Beispiel 1

Loading
Loading