← 返回 bloomberg 的题目列表Remove Consecutive Letters in a String
类型:online_judge
Given a string where some characters appear consecutively. The task is to recursively remove such consecutive characters if they appear three or more times in a row, until no more removals can be made. Return the final string.
Example 1:
Input: "aabbbaac"
Output: "c"
Example 2:
Input: "abcddde"
Output: "abe"
Constraints:
The string length is between 1 and 10^5.
Example
Input
aabbbaac