✅ One Line Solution
(Disclaimer: this is not an example to follow in a real project - it is written for fun and training mostly)Code #1Time complexity: O(n). Space complexity: O(1)
(Disclaimer: this is not an example to follow in a real project - it is written for fun and training mostly)

# Code #1
Time complexity: $$O(n)$$. Space complexity: $$O(1)$$.
```python3
class Solution:
    def numberOfSubstrings(self, s: str) -> int:
        return (z:=[-1]*3) and sum(setitem(z,ord(c)-ord('a'),i) or 1+min(z) for i,c in enumerate(s))
```

# Code #2
Time complexity: $$O(n)$$. Space complexity: $$O(1)$$.
```python3
class Solution:
    def numberOfSubstrings(self, s: str) -> int:
        return (z:={c:-1 for c in 'abc'}) and sum(1+min((z:=z|{c:i}).values()) for i,c in enumerate(s))
```

(Disclaimer 2: code above is just a product of fantasy packed into one line, it is not considered as 'true' oneliners - please, remind about drawbacks only if you know how to make it better)
['Hash Table', 'String', 'Sliding Window', 'Python', 'Python3']