You are viewing a single comment's thread. Return to all comments →
Used your idea in Python:
def super_reduced_string(s): res = [] # stack for c in s: if res and res[len(res)-1] == c: # peek what's on top res.pop() else: res.append(c) res = ''.join(res) return res or 'Empty String'
Easier to read comparing to perl, hu?
Seems like cookies are disabled on this browser, please enable them to open this website
Super Reduced String
You are viewing a single comment's thread. Return to all comments →
Used your idea in Python:
Easier to read comparing to perl, hu?