Dsa
Hashing
Easy
Finding Frequency of Words
You are given a text input consisting of multiple lines. Your task is to find the frequency of each unique word (case insensitive) and print the words in alphabetical order along with their frequencies.
Input Format:
- The first line contains an integer L, the number of lines of text to follow.
- The next L lines contain text where each line can have multiple words.
Output Format:
- Print each unique word followed by its frequency, sorted in alphabetical order.
Example Input:
3
Hello world
hello there
World of code
Example Output:
code 1
hello 2
the 1
there 1
world 2
Key concepts
hashingword frequencystring manipulation
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now