Concatenation of Three Palindromes
Hard
Execution time limit is 1 second
Runtime memory usage limit is 256 megabytes
Given a string s of length n, determine whether s can be expressed as a concatenation of three palindromes.
Input
The first line contains a natural number n (n ≤ 10000). The second line contains the string s with a length of n.
Output
If the string cannot be represented as a concatenation of three palindromes, output "NO". Otherwise, print "YES" on the first line, followed by the three palindromes on the next three lines, whose concatenation forms s. If there are multiple solutions, any valid set of palindromes can be provided.
Examples
Input #1
Answer #1
Submissions 56
Acceptance rate 4%