Question: (FOR PYTHON) Write a function, printStringStats(inputString), that takes as input a string of lowercase letters and prints three things: the lexicographically largest letter (z >

(FOR PYTHON) Write a function, printStringStats(inputString), that takes as input a string of lowercase letters and prints three things: the lexicographically largest letter (z > y > ... > a), the third largest letter, and the most common letter along with how many times it occurs. You may assume the string is at least one character long. But you may not assume that it contains at least three different characters. If fewer than three different letters appear in the string, print something appropriate for the third largest (e.g. "There is no third largest letter.") If two or more letters tie for most common, you may choose any one of them. For example:

>>> printStringStats('aaczzcqzqqqzqc') In 'aaczzcqzqqqzqc', the largest letter is 'z', the third largest letter is 'c', and the most common letter is 'q', occurring 5 times >>> printStringStats("aaaaba") In 'aaaaba', the largest letter is 'b', there is no third largest letter, and the most common letter is 'a', occurring 5 times 

NOTE: you may not use built-in min, max, sort, or sorted functions. You may not use any built-in string methods. Use one or more simple loops, and simple comparison (<,>, ==, !=) operators only.

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!