Tap here to switch tabs
Problem
Submissions

Problem: Find the Original Typed String I

med
30 min
Try to solve the Find the Original Typed String I problem.

Statement

You are given a string word that was produced by typing some original string, where during typing the key for a character may have been held down, causing that character to appear multiple times consecutively in word. Each maximal block of identical consecutive characters in word must correspond to at least one occurrence of that character in the original string.

Return the number of distinct original strings that could have resulted in word.

Constraints:

  • 1≤1 \leq word.length ≤100\leq 100

  • word consists only of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Original Typed String I

med
30 min
Try to solve the Find the Original Typed String I problem.

Statement

You are given a string word that was produced by typing some original string, where during typing the key for a character may have been held down, causing that character to appear multiple times consecutively in word. Each maximal block of identical consecutive characters in word must correspond to at least one occurrence of that character in the original string.

Return the number of distinct original strings that could have resulted in word.

Constraints:

  • 1≤1 \leq word.length ≤100\leq 100

  • word consists only of lowercase English letters.