You are given a string s consisting of lowercase English letters and special characters *, #, and %.
Process the characters of s sequentially from left to right to build a result string, starting with an empty string:
If the character is a lowercase English letter, append it to the end of the result string.
If the character is *, remove the last character from the result string.
If the character is #, duplicate the entire current result string.
If the character is %, reverse the entire current result string.
Return the final string after processing all characters in s.
Constraints:
s.length
s consists only of lowercase English letters and the characters *, #, and %.
You are given a string s consisting of lowercase English letters and special characters *, #, and %.
Process the characters of s sequentially from left to right to build a result string, starting with an empty string:
If the character is a lowercase English letter, append it to the end of the result string.
If the character is *, remove the last character from the result string.
If the character is #, duplicate the entire current result string.
If the character is %, reverse the entire current result string.
Return the final string after processing all characters in s.
Constraints:
s.length
s consists only of lowercase English letters and the characters *, #, and %.