Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. Write a function, 22(inputString, minLetter), that takes as input a string of letters and returns six things: the lexicographically smallest letter (z/Z>y/Y>...>a/A) greater or

image text in transcribed

2. Write a function, 22(inputString, minLetter), that takes as input a string of letters and returns six things: the lexicographically smallest letter (z/Z>y/Y>...>a/A) greater or equal to minLetter, the smallest index at which that letter occurs, the third smallest letter greater than minLetter, the smallest index at which that letter occurs, the most common letter, and how many times the most common letter occurs. The third smallest letter must be distinct from the second smallest which must be distinct from the smallest. E.g. 'b' is the second smallest and 'd' is the third smallest in 'ababdc' Ignore case during computation. E.g. 'z' and 'Z' are considered the same letter. Use lower case when returning letters. Return None for smallest and thirdSmallest letters and corresponding indices when appropriate. You may not assume that the input string contains at least three different characters (or even any characters at all). Make sure to recognize various situations where fewer than three different letters appear in the string, and where there is no third smallest or smallest greater than minLetter. If two or more letters tie for most common, return the lexicographically smallest one. For example: >>> 92('aacyYcqyQQqyqc', 'b') ('c', 2, 'y', 3, 'q', 5) >>> 920'aacyYcqyQQqyqc', 'r') C'y', 3, None, None, 'q', 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_2

Step: 3

blur-text-image_3

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 Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions

Question

Prove that a cubic function has exactly one point of inflection.

Answered: 1 week ago