Problem
Chloe wants to write a letter to her friend. Letter - string s, consisting of lowercase Latin letters.
Unfortunately, as soon as Chloe started writing the letter, she realized that it was too long, and it would take a very long time to write it in its entirety. So she wants to write a compressed version of the string s instead of the string itself.
A compressed version of the string s — the sequence of strings c
1, s
1, c
2, s
2, ..., c
k, s
k, where c
i — decimal representation of a
i (without leading zeros), and s
i — some string of lowercase Latin letters. If Chloe writes the string s
1 exactly a
1 times, then s
2 exactly a
2 times, and so on , it will produce the string s.
The length of the compressed version is |c
1| + |s
1| + |c
2| + |s
2|... |c
k| + |s
k|. Among all the compressed versions, Chloe wants to choose the one with the shortest length. Help Chloe find the shortest possible length.
Input:
The single line of the input contains a string s consisting of lowercase Latin letters (1 ≤ |s| ≤ 5000).
Output:
Print a single integer — the minimum length of the compressed version of the string s.
Examples:
Input |
Output |
aaaaaaaaaa |
3 |
abcab |
6 |
cczabababab |
7 |
Explanations:
In the first example, Chloe will select the following version: c
1 — 10, s
1 — a.
In the second example, Chloe will choose the following version: c
1 — 1, s
1 — abcab.
In the third example, Chloe will choose the following version: c
1 — 2, s
1 — c, c
2 — 1, s
2 — z, c
3 — 4, s
3 — ab.