Good String
Practice
3.9 (38 votes)
Ad Hoc
Approved
Basic programming
Easy
Implementation
Problem
93% Success 14966 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
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.
Explanation
We can make S a good string by removing one of the two a.
Code Editor
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Submissions
Please login to view your submissions
Similar Problems
Points:20
34 votes
Tags:
ImplementationBasic ProgrammingBasics of Greedy Algorithms
Points:20
836 votes
Tags:
Ad-HocSimulationEasyMathematicsOpenApprovedMathamatics
Points:20
29 votes
Tags:
Ad-HocAlgorithmsBasic ProgrammingBasics of ImplementationEasyImplementation
Editorial
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor