Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Substrings Consider a string,s-abc. An alphabetically-ordered sequence of substrings of s would be l'a, ab abe,bbe c'1. if we reduce this sequence to only those

image text in transcribed
Substrings Consider a string,s-"abc. An alphabetically-ordered sequence of substrings of s would be l'a", "ab abe,"bbe c'1. if we reduce this sequence to only those substrings that start with a vowel and end with a consonant, we're left with('ab abc")J. The alphabetically first element in this reduced list is "ab" and the alphabetically last element is 'abc. As a reminder: . Vowels: a, e, i,o, and u Consonants: b, e, d, .g.h.jk m, n, p, q. r.s.t,w,w.x y, and z Complete the findSubstrings function in your editor. It has 1 parameter: a string,s,consisting of lowercase English letters (a-z). The function must find the substrings of s that start with a vowel and end with a consonant, then print the alphabetically first and alphabetically last of these substrings Input Format The locked stub code in your editor reads a single string, s, from stdin and passes it to your function. Constraints 3 s length ofss5x10 Output Format Your function must print two lines of output denoting the alphabetically first and last substrings of s that start with a vowel and end with a consonant. Print the alphabetically first qualifying substring on the first line, and the alphabetically last qualifying substring on the second line. Substrings Consider a string,s-"abc. An alphabetically-ordered sequence of substrings of s would be l'a", "ab abe,"bbe c'1. if we reduce this sequence to only those substrings that start with a vowel and end with a consonant, we're left with('ab abc")J. The alphabetically first element in this reduced list is "ab" and the alphabetically last element is 'abc. As a reminder: . Vowels: a, e, i,o, and u Consonants: b, e, d, .g.h.jk m, n, p, q. r.s.t,w,w.x y, and z Complete the findSubstrings function in your editor. It has 1 parameter: a string,s,consisting of lowercase English letters (a-z). The function must find the substrings of s that start with a vowel and end with a consonant, then print the alphabetically first and alphabetically last of these substrings Input Format The locked stub code in your editor reads a single string, s, from stdin and passes it to your function. Constraints 3 s length ofss5x10 Output Format Your function must print two lines of output denoting the alphabetically first and last substrings of s that start with a vowel and end with a consonant. Print the alphabetically first qualifying substring on the first line, and the alphabetically last qualifying substring on the second line

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

Database Processing

Authors: David Kroenke

11th Edition

0132302675, 9780132302678

More Books

Students also viewed these Databases questions