Unique Length-3 Palindromic Subsequences - Leetcode 1930 - Python