From dcc322307d7bfa0e4f1a86b85df6e9b750fc5447 Mon Sep 17 00:00:00 2001 From: bumpsoo Date: Tue, 16 Jun 2026 14:25:04 +0000 Subject: [PATCH] https://leetcode.com/problems/process-string-with-special-operations-i --- .../process_string_with_special_operations_i.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 medium/process_string_with_special_operations_i.py diff --git a/medium/process_string_with_special_operations_i.py b/medium/process_string_with_special_operations_i.py new file mode 100644 index 0000000..6b8f5ec --- /dev/null +++ b/medium/process_string_with_special_operations_i.py @@ -0,0 +1,17 @@ +# https://leetcode.com/problems/process-string-with-special-operations-i + +class Solution: + def processStr(self, s: str) -> str: + result = [] + for ch in s: + match ch: + case '#': + result *= 2 + case '%': + result.reverse() + case '*': + if len(result) > 0: + result.pop() + case _: + result.append(ch) + return ''.join(result) \ No newline at end of file