Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given a string of lowercase English letters and an integer of the substring length, determine the substring of that length that contains the most vowels.

Given a string of lowercase English letters and an integer of the substring length, determine the substring of that length that contains the most vowels. Vowels are in the set {a,e,i,o,u}. If there is more than one substring with the maximum number of vowels, return the one that starts at the lowest index. If there are no vowels in the input string, return the string 'Not found!' without quotes.
Example 1
s= 'caberqiitefg'
k=5
The substring of length k=5 that contains the maximum number of vohels is 'erqii' with 3 vowels.
The final answer is 'erqii'.
Example 2
s= 'aeiouia'
k=3
All of the characters are vowels, so any substring of length 3 will have 3 vowels. The lowest index substring is at index 0, 'aei'.
Function Description
Complete the function findSubstring in the editor below.
findSubstring has the following parameters:
Returns:
string: a string containing the final answer
Constraints
1 length(s)2**105
1k length(s)
Input Format For Custom Testing
Sample Case 0
Sample Input
\table[[STDIN,,Function],[-----,,-----],[azerdii,,s=?' azerdii'],[,,k=5
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions