Best and easy solution  in Python 
Hello people 👋
Here is my solution:

The only thing you need to know is iterate till you get a valid string and then you know that rest all strings are going to
Hello people 👋

* Here is my solution:
* The only thing you need to know is iterate till you get a valid string and then you know that rest all strings are going to be valid so you add (n-r+1) 
    -- 
# Example
* abcabc  and n is length of the string 
* ```
  a b c a b c 
  r               is it valid ? No

  a b c a b c     is it valid ? No
    r 

  a b c a b c     is it valid ? Yes so now you need to stop moving   
      r           because there after it will still be valid string

  Now you need to count the rest of the characters i.e (abc)
  which is (n-r)  and add 1(current valid string) i.e n-r+1


 After this increment the left pointer and repeat the same process


 ```
# Code
```python3 []
class Solution:
    def numberOfSubstrings(self, s: str) -> int:

        vis={}
        l,r=0,0
        count=0
        n=len(s)
        while r<n:
            vis[s[r]]=vis.get(s[r],0)+1
            r+=1
            while len(vis)==3 :
                count+= (n-(r)+1) #Adding the rest of the characters to the valid string 
                vis[s[l]]-=1
                if vis[s[l]]==0:
                    del vis[s[l]]
                l+=1
            

        if len(vis)==3:
            count+=1
        return count
```


If you did like my explaination please give it an upvote 🙌🏻
see you at the next 

['Hash Table', 'Sliding Window', 'Python3']