Generate Tag for Video Caption

You are given a string caption representing the caption for a video.

The following actions must be performed in order to generate a valid tag for the video:

  • Combine all words in the string into a single camelCase string prefixed with '#'. A camelCase string is one where the first letter of all words except the first one is capitalized. All characters after the first character in each word must be lowercase.
  • Remove all characters that are not an English letter, except the first '#'.
  • Truncate the result to a maximum of 100 characters.

Return the tag after performing the actions on caption.

Example 1
Inputcaption = "Leetcode daily streak achieved"
Output"#leetcodeDailyStreakAchieved"
The first letter for all words except "leetcode" should be capitalized.
Example 2
Inputcaption = "can I Go There"
Output"#canIGoThere"
The first letter for all words except "can" should be capitalized.

Constraints

  • 1 <= caption.length <= 150
  • caption consists only of English letters and ' '.

Asked at 1 companies

</>

Your Solution

(Ctrl/Cmd + Enter)

Switching Language

Loading template...

Loading...

Sign in to save your progress

AI code evaluation

Get a correctness verdict, missed edge cases, and complexity analysis of your solution.

Sign in to evaluate