Challenge: Word Counter

Lab Python Intermediate 20 points

Read a sentence and count how many times each word appears. Ignore upper and lower case (treat The and the as the same word). Print the words in the order they first appear.

Input

One line of words separated by spaces (no punctuation).

Output

One line per word: word: count, in lower case.

Example

Input

The cat and the hat

Output

the: 2
cat: 1
and: 1
hat: 1
Sample input available Sample output available
Editor
Python

Hints

lower() before split() handles the case.

counts[word] = counts.get(word, 0) + 1

Dictionaries remember the order keys were added.

Solution explanation

This is the counting pattern from the lesson. Python dictionaries keep keys in the order they were added, so printing counts.items() follows first appearance.

Show solution
counts = {}
for word in input().lower().split():
    counts[word] = counts.get(word, 0) + 1
for word, count in counts.items():
    print(f"{word}: {count}")
Output
Answer
HOME LEARN COMMUNITY DASHBOARD