Substrings Of Size Three Leetcode Python