Looking for good programming challenges?

Use the search below to find our solutions for selected questions!

Next word

Sharing is caring!

Problem statement
Given a word $w$, consisting of characters `a-z`, `A-Z` and `0-9`, compute the next lexicographical word $w'$,
with `0-9` < `A-Z` < `a-z`.

Sample Input

Output

Solution