Archiver#5238

Archiver

2 seconds
256 megabytes
Hard

Vasya is on a mission to revolutionize the market with his innovative text compression technique for sequences of lowercase Latin letters. His method involves encoding text as a series of commands, which come in two types:

For instance, the command sequence a, b, 1 3 results in the string ababa, and the sequence a, 1 3, b, 3 3 results in the string aaaabaab.

The storage requirement for a command of the first type is byte, while a command of the second type requires bytes. Vasya can reconstruct the original text from these commands but cannot reverse the process. Your task is to assist Vasya in optimizing the storage of the given string using the least number of bytes possible.

Input

The input consists of a string composed of lowercase Latin letters, with a maximum length of characters.

Output

On the first line of the output, print the total number of bytes required to store the sequence of commands, followed by the number of commands in the sequence. In the subsequent lines, list each command on a new line. For a command of the first type, simply print the letter. For a command of the second type, print two numbers: the starting position of the character in the string (with positions starting at one) from which copying begins, and the number of characters to copy.

Examples

Example 1

Loading
Loading