Good String

3.9

38 votes
Ad-Hoc, Approved, Basic Programming, Easy, Implementation
Problem

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|S|105). 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.

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

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

Editor Image

?