Clean String
Practice
3.7 (3 votes)
Medium Hard
Problem
62% Success 1207 Attempts 50 Points 0.2s Time Limit 256MB Memory 1024 KB Max Code

Since October 2, 2014, India in under a cleanliness process- Swachh Bharat Abhiyan. The only aim of the movement is make our country look better. To make something look better not only cleanliness is required but if we keep things organised in certain order it looks better

Shabnam inspired by this fact wanted to organise everything in order. As she loves playing with words and strings she noticed that if the characters of the string are in certain order it would look better i.e. all the vowels in the string must appear before all the consonants in the string. She termed these type of string as a clean. For example the string "AIEBC" is a clean (as all the consonants of the string occurs after all the vowels in the string), whereas "AEIBSA" is not clean.

You are required to find the length of the longest sub-sequence of the string which is clean.

INPUT FORMAT:

First line of the input consist of a variable N denoting the length of the string S. Second line of input contains the string S

OUTPUT FORMAT:

Print the length of the longest sub-sequence of the string which is clean.

CONSTRAINTS:

1<=N<=10^5

NOTE:-The clean string should contain both vowels and consonants.

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

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:50
1 votes
Tags:
CombinatoricsDynamic ProgrammingAlgorithmsApprovedMedium-Hard
Points:50
Tags:
Medium-HardMedium-Hard
Points:50
6 votes
Tags:
Counting and ArrangementsDynamic ProgrammingAlgorithmsMedium-Hard
Editorial

No editorial available for this problem.