t | from collections import Counter, UserString | t | from collections import Counter, UserString |
| | | |
| | | |
| class SubString(UserString): | | class SubString(UserString): |
| def __sub__(self, new_str): | | def __sub__(self, new_str): |
| c2 = Counter(new_str) | | c2 = Counter(new_str) |
| ans = self | | ans = self |
| for c in c2: | | for c in c2: |
| ans = ans.replace(c, '', c2[c]) | | ans = ans.replace(c, '', c2[c]) |
| return ans | | return ans |
| | | |
| | | |
| s = '' | | s = '' |
| while True: | | while True: |
| try: | | try: |
| z = input() | | z = input() |
| if not(z.find('dir()') > 0): | | if not(z.find('dir()') > 0): |
| s += '\n' + z | | s += '\n' + z |
| else: | | else: |
| s += '\ndel Counter, UserString, s, z\n' + z | | s += '\ndel Counter, UserString, s, z\n' + z |
| except (KeyboardInterrupt, EOFError): | | except (KeyboardInterrupt, EOFError): |
| exec(s) | | exec(s) |
| from collections import Counter, UserString | | from collections import Counter, UserString |
| del Counter, UserString | | del Counter, UserString |
| raise SystemExit() | | raise SystemExit() |
| | | |