Skip to content

Practice Generate Tag for Video Caption

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#3582
LeetCode Problem

Generate Tag for Video Caption

Problem Statement

Given caption, first combine its words into a camelCase string prefixed with #. Lowercase the first word; capitalize the first letter of each later word and lowercase its remaining letters. Next remove every character that is not an English letter except the initial #. Finally truncate the complete result to at most 100 characters. Return the tag.

Source: Generate Tag for Video Caption on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
caption = "Leetcode daily streak achieved"
Output
"#leetcodeDailyStreakAchieved"

# Example 2

Input
caption = "can I Go There"
Output
"#canIGoThere"

# Example 3

Input
caption = "hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"
Output
"#hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"

Constraints

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

Related LeetCode Problems

Practice more problems similar to Generate Tag for Video Caption.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.