3 ms·
str1 = "a" str2 = "ab"
by xigoi 2y ago
str1 = "a"
str2 = "ab"
- BeFlatXIII 2y agoGood catch. Counter(str1) - Counter(str2) | Counter(str2) - Counter(str1) That ought to work. I'd hope Python's caching doesn't recompute the Counter for long strings.