020-003-004
Map: Word Frequency Counter
Hard
Problem Description
Map: Word Frequency Counter
In this problem, you will create a program that reads a list of words from standard input, counts each word's occurrences using HashMap<String, Integer>, and displays the count of a specified word in the format [word]: [count] to standard output.
Learning Objective: Use HashMap to manage key-value pairs and implement counting
Count word occurrences using Map and output count for specified word.
Input
Line 1: Number of words
Following lines: Each word
Last line: Word to check count
Output
[word]: [count]
Example
Input:
5
apple
banana
apple
orange
apple
apple
```java
Output:
```java
apple: 3
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up