#3614

Process String with Special Operations II

grandmaster · 2260 · lc hard +32 · 16.9% accepted · 92 likes · top 1%

Description

A string s of lowercase letters and special characters '*', '#', '%' is processed using the same rules as the simpler version (append letter, delete last on '*', duplicate on '#', reverse on '%'). An integer k is also given.

Return the k-th character (0-indexed) of the final result string. If k is out of range, return '.'.

Code

1
2
3