Preparando MOJI

Letters Cyclic Shift

1000ms 262144K

Description:

You are given a non-empty string s consisting of lowercase English letters. You have to pick exactly one non-empty substring of s and shift all its letters 'z' 'y' 'x' 'b' 'a' 'z'. In other words, each character is replaced with the previous character of English alphabet and 'a' is replaced with 'z'.

What is the lexicographically minimum string that can be obtained from s by performing this shift exactly once?

Input:

The only line of the input contains the string s (1 ≤ |s| ≤ 100 000) consisting of lowercase English letters.

Output:

Print the lexicographically minimum string that can be obtained from s by shifting letters of exactly one non-empty substring.

Sample Input:

codeforces

Sample Output:

bncdenqbdr

Sample Input:

abacaba

Sample Output:

aaacaba

Note:

String s is lexicographically smaller than some other string t of the same length if there exists some 1 ≤ i ≤ |s|, such that s1 = t1, s2 = t2, ..., si - 1 = ti - 1, and si < ti.

Informação

Codeforces

Provedor Codeforces

Código CF708A

Tags

constructive algorithmsgreedyimplementationstrings

Submetido 0

BOUA! 0

Taxa de BOUA's 0%

Datas 09/05/2023 09:08:37

Relacionados

Nada ainda