Collect the campaign hashtags
A social-media agency in Nairobi tracks which hashtags appear in its client's posts. A hashtag is a # that is at the start of the line or directly after whitespace, followed by one or more letters, digits or underscores. The hashtag ends at the first character that is not a letter, digit or underscore, so #SaleTime! gives saletime. A # in the middle of a word (like mail#tag) is not a hashtag.
Task: read one line (a post). Print every distinct hashtag in lower case, each with its leading #, in the order of first appearance, separated by single spaces. If the post has no hashtag print the word none.
Sample tests
Input
Big #Sale today! Visit us #Nairobi #sale #BlackFriday2026.
Expected output
#sale #nairobi #blackfriday2026
Input
No tags here, just text
Expected output
none
Your answer is also checked against 3 hidden tests.
Log in or create a free account to run your code, submit and earn points.
Run your code to see the output here. Ctrl + Enter also runs it.
