Collections Utility: Word Operations
Problem Description
Collections Utility: Word Operations
In this problem, you will create a program that reads multiple words, counts the occurrence of the first word using Collections.frequency(), sorts all words alphabetically using Collections.sort(), and displays the results to standard output.
Learning Objective: Use Collections class frequency() and sort() methods
Collections class has convenient methods like frequency() counting element occurrences and sort() sorting list. Count how many times specific word appears with Collections.frequency(list, "word"), arrange list in alphabetical order with Collections.sort(list). Using these enables writing complex processing easily.
Input
Line 1: Number of words (integer, 1-10 words)
Lines 2~N+1: Word (string)
Output
Word Operations:
Original: [word 1] [word 2] ...
First Word Count: [occurrence count]
Sorted: [word] [word] ...
Test Cases
※ Output examples follow programming industry standards
5 apple banana apple orange apple
Word Operations: Original: apple banana apple orange apple First Word Count: 3 Sorted: apple apple apple banana orange
4 cat dog bird fish
Word Operations: Original: cat dog bird fish First Word Count: 1 Sorted: bird cat dog fish
Your Solution
You have 10 free executions remaining
