harbor run -t openthoughts/tasktrove-exp-rpt-taco-v2-taco-6752
harbor download openthoughts/tasktrove-exp-rpt-taco-v2-taco-6752
Write a function that counts the number of characters that need to be removed from a given string to eliminate consecutive repetitions of characters.
def count_characters_to_remove(s: str) -> int:
s
Input: 'abbbbc' Output: 3 Explanation: Converting 'abbbbc' to 'abc' requires removing three 'b's.
'abbbbc'
3
Input: 'abbcca' Output: 2 Explanation: To change 'abbcca' to 'abca', we remove one 'b' and one 'c'.
'abbcca'
2
Input: 'ab cca' Output: 1 Explanation: Removing one space from 'ab cca' gives 'ab ca', which has no consecutive repeats.
'ab cca'
1
Place the solution in the /app/ directory.
/app/
Important: place your implementation at /app/solution.py so the verifier can run it.
/app/solution.py