Reverse Only Letters Leetcode Solution Python