Alice is a programmer who's trying to type a specific string on her keyboard, but she's having a rough day! ๐คฆโโ๏ธ Sometimes when she presses a key, she accidentally holds it down a bit too long, causing that character to appear multiple times in a row.
Here's the catch: Alice knows she's clumsy, so she's being extra careful. She's confident that at most one character might have been accidentally repeated in her entire typing session.
Given the word that finally appeared on Alice's screen, your task is to determine how many different original strings Alice could have intended to type.
Example: If Alice's screen shows "aab", she could have intended to type either:
"aab"(no mistakes)"ab"(the first 'a' was accidentally repeated)
So the answer would be 2 possible original strings.
Input & Output
Constraints
- 1 โค word.length โค 105
- word consists of lowercase English letters only
- Alice made at most one mistake (held one key too long)