Dsa
Sorting
Medium
Unique Word Sort
You are given a list of sentences. Your task is to extract all unique words from these sentences, sort them alphabetically, and print them in a single line separated by spaces. The input consists of multiple sentences, each ending with a newline. A word is defined as a sequence of alphabetical characters.
Example:
Input:
"Hello world."
"Hello again!"
"The world is vast."
Output:
again Hello is The vast world
Key concepts
sortingstringssets
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