Leaderboard
Showing:
Sandwiched_Vowels
Basic Accuracy: 47.23% Submissions: 111 Points: 1

For a given string S, comprising of only lowercase English alphabets, eliminate the vowels from the string that occur between two consonants(sandwiched between two immediately adjacent consonants). Print the updated string on a new line.

Example 1:

Input : S = "bab"
Output : bb
Explanation:
a is a vowel occuring between two consonants i.e. b. 
Hence the updated string eliminates a.

Example 2:

Input : S = "ceghij"
Output : cghj

 

Your Task:
This is a function problem. The input is already taken care of by the driver code. You only need to complete the function Sandwiched_Vowel() that takes a String (s), and return the updated String. The driver code takes care of the printing.

Expected Time Complexity: O(N).
Expected Auxiliary Space: O(1).

 

Constraints:

1 ≤ L ≤ 105, where L is length of string S

'a' ≤ S[i] ≤ 'z', i is an integer denoting index of S

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Sandwiched_Vowels

Output Window