Problem 174253 · easy · Level 01 Prerequisites & Setup

A Hashtag for the Poster

strings · split · capitalize · join

Turn a phrase into a hashtag: capitalise every word (its first character upper case, all the rest lower case, so 3d stays 3d), remove the spaces, and put # in front. Extra spaces anywhere are ignored. If the phrase contains no words, return "#".

Examples

Input:  phrase = "bake sale today"
Output: "#BakeSaleToday"

Input:  phrase = "  pYTHON is   FUN "
Output: "#PythonIsFun"

Constraints

  • 0 <= len(phrase) <= 500
  • phrase may contain letters, digits and spaces

Goals

  • Capitalise each word
  • Join words with no separator
  • Add a prefix
Starting Python…