3330. Find the Original Typed String I Easy

@problem@discussion
#String



1/**
2 * [3330] Find the Original Typed String I
3 *
4 * Alice is attempting to type a specific string on her computer. However, she tends to be clumsy and may press a key for too long, resulting in a character being typed multiple times.
5 * Although Alice tried to focus on her typing, she is aware that she may still have done this at most once.
6 * You are given a string word, which represents the final output displayed on Alice's screen.
7 * Return the total number of possible original strings that Alice might have intended to type.
8 *  
9 * <strong class="example">Example 1:
10 * <div class="example-block">
11 * Input: <span class="example-io">word = "abbcccc"</span>
12 * Output: <span class="example-io">5</span>
13 * Explanation:
14 * The possible strings are: "abbcccc", "abbccc", "abbcc", "abbc", and "abcccc".
15 * </div>
16 * <strong class="example">Example 2:
17 * <div class="example-block">
18 * Input: <span class="example-io">word = "abcd"</span>
19 * Output: <span class="example-io">1</span>
20 * Explanation:
21 * The only possible string is "abcd".
22 * </div>
23 * <strong class="example">Example 3:
24 * <div class="example-block">
25 * Input: <span class="example-io">word = "aaaa"</span>
26 * Output: <span class="example-io">4</span>
27 * </div>
28 *  
29 * Constraints:
30 * 
31 * 	1 <= word.length <= 100
32 * 	word consists only of lowercase English letters.
33 * 
34 */
35pub struct Solution {}
36
37// problem: https://leetcode.com/problems/find-the-original-typed-string-i/
38// discuss: https://leetcode.com/problems/find-the-original-typed-string-i/discuss/?currentPage=1&orderBy=most_votes&query=
39
40// submission codes start here
41
42impl Solution {
43    pub fn possible_string_count(word: String) -> i32 {
44        0
45    }
46}
47
48// submission codes end
49
50#[cfg(test)]
51mod tests {
52    use super::*;
53
54    #[test]
55    fn test_3330() {
56    }
57}
58


Back
© 2025 bowen.ge All Rights Reserved.