#P3881. [JLOI2008] CODES
[JLOI2008] CODES
Description
Given code strings , your task is to find a code string such that it can be decomposed in at least two different ways as a concatenation of the .
For example:
Given code strings: $S_1=\texttt{0110}, S_2=\texttt{00}, S_3=\texttt{111}, S_4=\texttt{001100}, S_5=\texttt{110}$. Then one valid code string is: \texttt{001100110}, which has the following two decompositions:
\texttt{00}+\texttt{110}+\texttt{0110} or \texttt{001100}+\texttt{110} .
But 0110110 does not meet the requirement; it has only one decomposition \texttt{0110}+\texttt{110} .
You must find the shortest valid code string . If there are multiple shortest valid code strings , output the lexicographically smallest one.
Input Format
The first line contains an integer , the number of code strings. Each of the next lines contains one code string of length at most .
Output Format
Output two lines. The first line is the length of the required code string . The second line is the code string . For all the testdata, a solution always exists.
5
0110
00
111
001100
110
9
001100110
Hint
- .
Translated by ChatGPT 5
京公网安备 11011102002149号