All Tracks Algorithms String Algorithms String Searching Problem

String
Tag(s):

Algorithms, String, String Searching, Very-Easy

Problem
Editorial
Analytics

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 :

$$ 1 \le N \le 100, 000 $$

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

SAMPLE INPUT
5
aaaaa
SAMPLE OUTPUT
0
Explanation

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

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, TypeScript, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

HackerEarth

Challenge Name

August Circuits '18

OTHER PROBLEMS OF THIS CHALLENGE
通知
View All Notifications

?