Given two strings and , construct a compressed suffix tree that contains all suffixes of both strings.
Find such a tree that contains the minimum possible number of vertices.
The first line contains the string (1 \leq |\textbf{s}| \leq 10^5), where the last character is "", and all other characters are lowercase Latin letters.
The second line contains the string (1 \leq |\textbf{t}| \leq 10^5), where the last character is "\textbf{#}", and all other characters are lowercase Latin letters.
Number the vertices of the tree from to n - 1 in depth-first search order, traversing subtrees in lexicographical order of outgoing edges from each vertex. Use ASCII codes to determine the order of characters.
On the first line, output an integer — the number of vertices in the tree. In the next n - 1 lines, output the description of each vertex (except the root), in increasing order of their numbers.
Each vertex description consists of four integers: , , , , where (0 \leq p < n, p \neq v) is the parent of the current vertex , (0 \leq w \leq 1) is the index of the string for edge substring identification. If w = 0, the edge from to contains substring \textbf{s}[lf \ldots rg - 1] (0 \leq lf < rg \leq |\textbf{s}|), and if w = 1, it contains substring \textbf{t}[lf \ldots rg - 1] (0 \leq lf < rg \leq |\textbf{t}|).
Example 1
Example 2
A substring \textbf{s}[l \ldots r] (0 \leq l \leq r < |\textbf{s}|) means the string \textbf{s}_l \textbf{s}_{l+1} \ldots \textbf{s}_r, where \textbf{s} = s_0 s_1 \ldots s_{|\textbf{s}| - 1} and is the length of .