All Tracks Basic Programming Implementation Basics of Implementation Problem

Good String
Tag(s):

Ad-Hoc, Basic Programming, Easy, Implementation

Problem
Editorial
Analytics

Given a string $$S$$, print the minimum number of characters you have to remove from the string $$S$$ to make it a good string. A good string is a string in which all the characters are distinct.

Input:
First line of input contains a string $$S$$, $$(1 \le |S| \le 10^5)$$. $$S$$ consists of lowercase characters only.

Output:
Print an integer denoting the minimum number of characters you have to remove from $$S$$ to make it a good string.

SAMPLE INPUT
aabc
SAMPLE OUTPUT
1
Explanation

We can make $$S$$ a good string by removing one of the two $$a$$.

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: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Visual Basic, Kotlin

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

HackerEarth

Challenge Name

January Circuits '17

OTHER PROBLEMS OF THIS CHALLENGE
Notifications
View All Notifications