leetle

Daily challenge for 2025-11-18

322. Reverse Only Letters

Given a string s, reverse the string according to the following rules:

- All the characters that are not English letters remain in the same position.
- All the English letters (lowercase or uppercase) should be reversed.

Return the modified string.

Example:
Input: s = "ab-cd"
Output: "dc-ba"

Example 2:
Input: s = "a-bC-dEf-ghIj"
Output: "j-Ih-gfE-dCba"

Run this challenge interactively in Python or JavaScript when the app loads.