Replace All Digits with Characters Problem

Replace All Digits with Characters Problem — ExecCode Easy DSA Practice

Solve the Replace All Digits with Characters problem on ExecCode. Free online easy DSA practice in String. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given a 0-indexed string s that has lowercase English letters in its even indices and digits in its odd indices. Your task is to compute the required answer and return s after replacing all digits. You must perform an operation shift(c, x), where c is a character and x is a digit, that returns the x^th character after c. - For example, shift('a', 5) = 'f' and shift('x', 0) = 'x'. For every odd index i, you want to replace the digit s[i] with the result of the shift(s[i-1], s[i]) operation. It is guaranteed that shift(s[i-1], s[i]) will never exceed 'z'.

Examples

Input {"s": "a1c1e1"}; Output abcdef. Input {"s": "a1b2c3d4e"}; Output abbdcfdhe

Constraints

1 <= s.length <= 100 s consists only of lowercase English letters and digits. shift(s[i-1], s[i]) <= 'z' for all odd indices i.

Practice Replace All Digits with Characters free on ExecCode. Browse DSA problems, topic map, and placement guides.