小红书笔试,求剩下两道的代码
第一题:笔记草稿
string = input() string_list = list(string) res = [] char = ['(', ')', '<'] flag = 0 for i in string_list: if i not in char: if flag == 0: res.append(i) if i == '(': flag += 1 if i == ')': flag -= 1 if i == '<' and flag==0: if len(res) > 0: res.pop() print(''.join(res))