Reverse Only Letters Problem

Reverse Only Letters Problem — ExecCode Easy DSA Practice

Solve the Reverse Only Letters problem on ExecCode. Free online easy DSA practice in Two Pointers. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given a string s, reverse the string according to the following rules:. Your task is to compute the required answer and return s after reversing it. All the characters that are not English letters remain in the same position. - All the English letters (lowercase or uppercase) should be reversed.

Examples

Input {"s": "ab-cd"}; Output dc-ba. Input {"s": "a-bC-dEf-ghIj"}; Output j-Ih-gfE-dCba

Constraints

1 <= s.length <= 100 s consists of characters with ASCII values in the range [33, 122]. s does not contain '\"' or '\\'.

Practice Reverse Only Letters free on ExecCode. Browse DSA problems, topic map, and placement guides.