Question
Write a function, q1(inputString), that takes as input a string of letters and prints three things: the lexicographically largest largest letter (z/Z > y/Y >
Write a function, q1(inputString), that takes as input a string of letters and prints three things: the lexicographically largest largest letter (z/Z > y/Y > ... > a/A), the third largest letter, and the most common letter along with how many times that letter occurs. When printing the largest and third largest and most common letters, the output can be either lower or upper case so long as the letter appears at least once with that case in the input string. 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 print something appropriate for those situations. If two or more letters tie for most common, you may choose any one of them. For example:
>>> q1('aacyYcqyQQqyqc') In 'aacyYcqyQQqyqc', the largest letter is 'y', the third largest letter is 'c', and the most common letter is 'q', occurring 5 times >>> q1("bBBbAb") In 'bBBbAb', the largest letter is 'b', there is no third largest letter, and the most common letter is 'b', occurring 5 times
NOTE: you may not use built-in min, max, sort, or sorted functions (you should also not write your own sorting method). You may not use any built-in string methods (other than .lower()). You may use [] to access single characters of a string, if you wish. Use one or more simple loops, and simple comparison (<,>, ==, !=) operators only.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started