String

3.8

25 votes
Algorithms, Easy, String Manipulation
Problem

You are given a String S of size N, consisting of lowercase English characters. Now, you need to select a single English lowercase alphabet, and delete all occurences of it from the given string S

Considering you do the mentioned exactly once over the given string, what is the minimum possible length of the resultant string ?

Input Format :

The first line contains a single integer N. The next line contains a String S of length N consisting of lowercase Englsh characters.

Output Format :

Print the required answer on a single line

Constraints :

1N100,000

Note that the Expected Output feature of Custom Invocation is not supported for this contest. 

Sample Input
5
aaaaa
Sample Output
0
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

We can delete all occurences of the letter "a" to get a resultant string of length 0.

Editor Image

?