class Solution:
"""
@param inputA: Input stream A
@param inputB: Input stream B
@return: The answer
"""
def result_input(self, input_):
# 返回处理backspace之后的输入流
b = []
for i in input_:
b.append(i)
if i == '<':
if len(b) -1:
b.pop(-1)
b.pop(-1)
else:
b.pop(-1)
if b:
return b
else:
return None
def inputStream(self, inputA, inputB):
# Write your code here
a = self.result_input(inputA)
b = self.result_input(inputB)
print(a, b)
if a == b :
return 'YES'
else:
return 'NO'
python. 输入流 给出两个输入流inputA和inputB,有Backspace,如果两个输入流最后的结果相等,输出YES,否则输出NO。
猜你喜欢
转载自blog.csdn.net/qq_35994802/article/details/82721679
今日推荐
周排行