303662: CF708A. Letters Cyclic Shift

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Letters Cyclic Shift

题意翻译

给你一个由小写英文字母组成的非空字符串。你必须选择一个s的非空子串,并移动它的所有字母“z”y“x”b“a”z。换句话说,每个字符都被替换为英文字母的前一个字符,而“a”被替换为“z”。通过执行一次移位,可以从s中获得什么样的字典上的最小字符串?

题目描述

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' ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF708A/355fee5161a1808ee95ea5dc6d815d4071657131.png) 'y' ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF708A/355fee5161a1808ee95ea5dc6d815d4071657131.png) 'x' ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF708A/23d27bb9cf2cd76a0555d2babeb08bc9315530bc.png) 'b' ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF708A/355fee5161a1808ee95ea5dc6d815d4071657131.png) 'a' ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF708A/355fee5161a1808ee95ea5dc6d815d4071657131.png) '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?

输入输出格式

输入格式


The only line of the input contains the string $ s $ ( $ 1<=|s|<=100000 $ ) consisting of lowercase English letters.

输出格式


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

输入输出样例

输入样例 #1

codeforces

输出样例 #1

bncdenqbdr

输入样例 #2

abacaba

输出样例 #2

aaacaba

说明

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}&lt;t_{i} $ .

Input

题意翻译

给你一个由小写英文字母组成的非空字符串。你必须选择一个s的非空子串,并移动它的所有字母“z”y“x”b“a”z。换句话说,每个字符都被替换为英文字母的前一个字符,而“a”被替换为“z”。通过执行一次移位,可以从s中获得什么样的字典上的最小字符串?

加入题单

上一题 下一题 算法标签: