Company: Schrodinger
Difficulty: medium
You are given a string s of length n consisting of lowercase English letters. You must delete exactly one contiguous substring of s . The substring you delete may be empty , and it may be any block of consecutive positions of s . After the deletion, the characters that remain are the part of s before the deleted block followed by the part of s after it, concatenated in their original order. The deletion is valid only if every character of the remaining string is distinct (no letter appears twice). Report the minimum possible length of the deleted block over all valid deletions. Input Format The first line contains a single integer n — the length of the string. The second line contains the string s of length n , made up of lowercase English letters ( 'a' – 'z' ). Output Format Print a single integer — the minimum length of the contiguous block that has to be deleted so that all characters of the remaining string are distinct. Constraints 1 <= n <= 100000 s cont