Substrings Of Size Three Leetcode Problems Python