#c221403. They Are Everywhere

They Are Everywhere

They Are Everywhere

Problem Source

CF 701C

Problem Description

You are given a string of length nn, consisting of uppercase and lowercase English letters.

You need to find the shortest substring that contains all the characters that appear in the string.

Output the length of the shortest such substring.

Input Format

The first line contains an integer nn.

The next line contains a string ss of length nn.

Output Format

Output one line containing a number: the answer.

Sample Input 1

7
bcAAcbc

Sample Output 1

3

Sample Input 2

6
aaBCCe

Sample Output 2

5

Constraints

For 100%100\% of the data, 1≤n≤1051 \leq n \leq 10^5.