Алмаз Сейтхазин (КФ МГУ, кафедра НДС) SubString 7226
Барлыбай Мади, 311/312 группа SubString 8153
t1import collectionst1import collections
22
3class SubString(collections.UserString):3class SubString(collections.UserString):
44
5    def __sub__(self, other):5    def __sub__(self, other):
6        from collections import Counter6        from collections import Counter
7        other_counter = Counter(other)7        other_counter = Counter(other)
8        result_chars = []8        result_chars = []
9        for char in self.data:9        for char in self.data:
10            if other_counter.get(char, 0) > 0:10            if other_counter.get(char, 0) > 0:
11                other_counter[char] -= 111                other_counter[char] -= 1
12            else:12            else:
13                result_chars.append(char)13                result_chars.append(char)
14        return SubString(''.join(result_chars))14        return SubString(''.join(result_chars))
15del collections15del collections
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op