β back to unit
Challenge
# searching advanced
Most Common Letter, the Slow Way
The spy counts which letter a secret message uses most β with pencil and paper, no fancy tools. π΅οΈ
You get a lowercase word (at least one letter). Print its most common letter. On a tie, print whichever tied letter appears FIRST in the word. (No dictionaries β count each letter with loops.)
Example:
Input: word = "banana"
Output: a
Counting each letter gives b=1, a=3, n=2 β "a" appears the most.
π‘ need a hint?
srch-most-common-letter.pyπ given lines are locked β write your code in between
loading...