#C3922. Minimum Operations to Delete All Characters in a String
Minimum Operations to Delete All Characters in a String
Minimum Operations to Delete All Characters in a String
You are given a string S consisting of lowercase English letters. In one operation, you can delete a contiguous group of identical characters from the string. Your task is to determine the minimum number of operations required to delete all characters of the string.
In other words, you need to count the number of groups of consecutive identical characters in the string. For example, the string "ababa" has 5 groups: 'a', 'b', 'a', 'b', 'a'.
Note: An empty string requires 0 operations.
inputFormat
The input consists of a single line containing the string S. The string may be empty. All characters in the string are lowercase English letters.
outputFormat
Output a single integer representing the minimum number of operations (i.e., the number of contiguous groups of identical characters) needed to delete the entire string.
## sampleababa
5