Юань Дунлян, 523 Группа SubString 13306
Кизин Кирилл, 118 группа SubString 12862
f1import collectionsf1import collections
22
3class SubString(collections.UserString):3class SubString(collections.UserString):
44
5    def __sub__(self, other):5    def __sub__(self, other):
6        import collections6        import collections
n7        left_counter = collections.Counter(self)n7        cl = collections.Counter(self)
8        right_counter = collections.Counter(other)8        cr = collections.Counter(other)
9        result_str = ''9        ans_str = ''
10        for char in self:10        for ch in self.data:
11            if left_counter[char] > 0 and right_counter[char] > 0:11            if cl[ch] > 0 and cr[ch] > 0:
12                cl[ch] -= 1
12                left_counter[char] -= 113                cr[ch] -= 1
13                right_counter[char] -= 1
14            else:14            else:
n15                result_str += charn15                ans_str += ch
16        del collections16        del collections
t17        return self.__class__(result_str)t17        return self.__class__(ans_str)
18del collections18del collections
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op