Shifting Letters II - Leetcode 2381 - Python