Leetcode | 2381 Shifting Letters II | Java | Prefix Concept