Word Frequency with Counter
Given a line of words, use collections.Counter to find and print the 3 most common words.
What the problem means: Counter is a Standard Library tool built exactly for this — counting how many times each item appears — so you don't need to write the counting loop yourself.
Approach: split the line into words, build a Counter from them, and call .most_common(3).
Input: One line: space-separated words.
Output: One line: the 3 most common words with their counts, as a Python list of tuples.
apple banana apple cherry apple banana
[('apple', 3), ('banana', 2), ('cherry', 1)]- 1 <= number of words <= 1000
Hint 1
Counter(words) counts every word's occurrences in one step.
Hint 2
.most_common(3) returns the 3 most frequent items as (word, count) tuples, most frequent first.
Hint 3
Ties are broken by the order words first appeared, since Counter is a dictionary under the hood.
Counter(words) builds a dictionary-like object mapping each word to how many times it appeared, in a single line. .most_common(3) then returns the top 3 as a list of (word, count) tuples, ordered from most to least frequent, breaking ties by first-appearance order.