Question: double_vowels Given a string, return a copy of the string with all of the vowels doubled. Consider the five letters 'aeiou' as vowels. double_vowels('pencil') 'peenciil'

double_vowels

Given a string, return a copy of the string with all of the vowels doubled. Consider the five letters 'aeiou' as vowels.

double_vowels('pencil') 'peenciil' double_vowels('xyzzy') 'xyzzy' double_vowels('catalog') 'caataaloog'

middle_hash

Given a string, do three hash marks '###' appear in the middle of the string? To define middle, we'll say that the number of chars to the left and right of the '###' must differ by at most one.

middle_hash('aa###bb') True middle_hash('aaa###bb') True middle_hash('a###bbb') False

fence_post

Given two strings, fence and post, return a string made up of count instances of post, separated by instances of fence. Note: This is an example of the classic "fence post" programming problem. It's a variant of the off-by-one-error (OBOE).

fence_post('X', 'Word', 3) 'WordXWordXWord' fence_post('And', 'This', 2) 'ThisAndThis' fence_post('And', 'This', 1) 'This'

balanced_x_y

We'll say that a String is xy-balanced if for all the 'x' chars in the string, there exists a 'y' char somewhere later in the string. So 'xxy' is balanced, but 'xyx' is not. One 'y' can balance multiple 'x's. Return true if the given string is xy-balanced.

balanced_x_y('aaxbby') True balanced_x_y('aaxbb') False balanced_x_y('yaaxbb') False

repeated_prefix

Given a string, consider the prefix string made of the first N chars of the string. Does that prefix string appear somewhere else in the string? Assume that the string is not empty and that N is in the range 1..len(str).

repeated_prefix('abXYabc', 1) True repeated_prefix('abXYabc', 2) True repeated_prefix('abXYabc', 3) False

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!