P18023 [GeeksforGeeks] Remove b and ac from a given string4336
普及-
题目描述

Given a string, eliminate all “b” and “ac” in the string, replace them in-place and iterate over the string once.
Example 1:
Input: str = "aacbacc"
Output: ac
Explanation: Iterate once and remove
occurrence of "b" and "ac"
Example 2:
Input: str = "aacb"
Output: a
Explanation: Iterate once and remove
occurrence of "b" and "ac"
Your task:
Your task is to complete the function stringFilter() which takes a single string as input and modify the string as mentioned above. You need not take any input or print anything.

Expected Time Complexity: O(|s|)
Expected Auxiliary Space: O(1)
Constraints:
1 <= |S| <= 10^{5}
String contains lower case alphabets

输入格式

见题面

输出格式

见题面

样例输入
str = "aacbacc"
样例输出
ac