A document scrubber must remove every copy of one specific character from a line of text. Write redact(s, ch) returning s with all occurrences of the single character ch deleted, using recursion (no loops, no str.replace, no comprehensions).
Examples
Input: s = "balloon", ch = "l"
Output: "baoon"
Input: s = "aaa", ch = "a"
Output: ""
Constraints
0 <= len(s) <= 2000;chis one character.- Recursion depth is at most
len(s).
Goals
- Decide per character whether to keep it, then recurse on the rest
- Return an empty string from the base case
- Understand that string concatenation drives the cost of naive recursion