Pseudo-template#5936

Pseudo-template

5 seconds
512 megabytes
Hard

A string is considered a pattern of another string if the combined occurrences of within completely cover . This means that every position in is covered by at least one occurrence of . For example, the string is a pattern for .

A string is defined as a pseudo-pattern of a string if it meets the following criteria:

For example, the string is a pseudo-pattern of because it appears as a substring and serves as a pattern for the string .

Given a string , your task is to determine the number of its pseudo-patterns and identify the shortest one.

Input

The input consists of a single string with a length ranging from to 2 \cdot 10^5, composed of lowercase Latin letters.

Output

On the first line, output the total number of pseudo-patterns for the given string. On the second line, output the shortest pseudo-pattern. If there are multiple pseudo-patterns of the shortest length, choose the lexicographically smallest one.

Examples

Example 1

Loading
Loading