2025-08-24 10:31:22 +0000 UTC

Find the Original Typed String I

Code

class Solution:
    def possibleStringCount(self, word: str) -> int:
        res, n = 1, len(word)
        for i in range(1, n):
            cur, prev = word[i], word[i - 1]
            if cur == prev:
                res += 1
        return res