Substrings Of Size Three Leetcode Solutions Python