You are given a string containing lowercase Latin letters. The distance between two symbols s_i and s_j in this string is the difference between their positions, i.e., |j - i|. Consider all pairs of identical symbols located at different positions and calculate the distance for each such pair.
Write a program to determine the minimum of all such distances.
The input contains a single string . The length of the string does not exceed 5 \cdot 10^6.
Output a single number: the minimal distance between identical symbols. If there are no pairs of identical symbols in the string, output 0.
Example 1