3582. Generate Tag for Video Caption Easy
1/**
2 * [3582] Generate Tag for Video Caption
3 *
4 * You are given a string <font face="monospace">caption</font> representing the caption for a video.
5 * The following actions must be performed in order to generate a valid tag for the video:
6 * <ol>
7 *
8 * 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.
9 *
10 *
11 * Remove all characters that are not an English letter, except the first '#'.
12 *
13 *
14 * Truncate the result to a maximum of 100 characters.
15 *
16 * </ol>
17 * Return the tag after performing the actions on caption.
18 *
19 * <strong class="example">Example 1:
20 * <div class="example-block">
21 * Input: <span class="example-io">caption = "Leetcode daily streak achieved"</span>
22 * Output: <span class="example-io">"#leetcodeDailyStreakAchieved"</span>
23 * Explanation:
24 * The first letter for all words except "leetcode" should be capitalized.
25 * </div>
26 * <strong class="example">Example 2:
27 * <div class="example-block">
28 * Input: <span class="example-io">caption = "can I Go There"</span>
29 * Output: <span class="example-io">"#canIGoThere"</span>
30 * Explanation:
31 * The first letter for all words except "can" should be capitalized.
32 * </div>
33 * <strong class="example">Example 3:
34 * <div class="example-block">
35 * Input: <span class="example-io">caption = "hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"</span>
36 * Output: <span class="example-io">"#hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"</span>
37 * Explanation:
38 * Since the first word has length 101, we need to truncate the last two letters from the word.
39 * </div>
40 *
41 * Constraints:
42 *
43 * 1 <= caption.length <= 150
44 * caption consists only of English letters and ' '.
45 *
46 */
47pub struct Solution {}
48
49// problem: https://leetcode.com/problems/generate-tag-for-video-caption/
50// discuss: https://leetcode.com/problems/generate-tag-for-video-caption/discuss/?currentPage=1&orderBy=most_votes&query=
51
52// submission codes start here
53
54impl Solution {
55 pub fn generate_tag(caption: String) -> String {
56 String::new()
57 }
58}
59
60// submission codes end
61
62#[cfg(test)]
63mod tests {
64 use super::*;
65
66 #[test]
67 fn test_3582() {
68 }
69}
70Back
© 2026 bowen.ge All Rights Reserved.