708A.md (1678B)
1 Source: https://codeforces.com/problemset/problem/708/A 2 3 A. Letters Cyclic Shift 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 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'. 22 23 What is the lexicographically minimum string that can be obtained from *s* by performing this shift exactly once? 24 25 Input 26 27 The only line of the input contains the string *s* (1 ≤ |*s*| ≤ 100 000) consisting of lowercase English letters. 28 29 Output 30 31 Print the lexicographically minimum string that can be obtained from *s* by shifting letters of exactly one non-empty substring. 32 33 Examples 34 35 Input 36 37 ``` 38 codeforces 39 ``` 40 41 Output 42 43 ``` 44 bncdenqbdr 45 ``` 46 47 Input 48 49 ``` 50 abacaba 51 ``` 52 53 Output 54 55 ``` 56 aaacaba 57 ``` 58 59 Note 60 61 String *s* is lexicographically smaller than some other string *t* of the same length if there exists some 1 ≤ *i* ≤ |*s*|, such that *s*1 = *t*1, *s*2 = *t*2, ..., *s**i* - 1 = *t**i* - 1, and *s**i* < *t**i*.