Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Julia has a string, s, consisting of one or more of the following letters: a, e, i, o, and u We define a magical subsequence

image text in transcribedimage text in transcribed

Julia has a string, s, consisting of one or more of the following letters: a, e, i, o, and u We define a magical subsequence of s to be a sequence of letters derived from s that contains all five vowels in order This means a magical subsequence will have one or more a's followed by one or more e's followed by one or more i's fol- lowed by one or more o's followed by one or more u's. For ex ample, if s "aeeiooua", then "aeiou" and "aeeioou" are magi cal subsequences but "aeio" and "aeeioua" are not. Complete the longestSubsequence function in your editor. It has 1 parameter: a string, s. It must return an integer denoting the length of the longest magical subsequence in s. If no mag ical subsequence can be constructed, return 0 Output Format Your function must return an integer denoting the length of the longest magical subsequence in s (if no such subsequence exists, this value is 0) This is printed to stdout by the locked stub code in your editor aeiaaioooaauuaeiou Sample Output 10 In the table below, the component characters of the longest magical sub- sequence are red: Input Format The locked stub code in your editor reads a single string, s, from stdin and passes it to your function Constraints 5

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

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago