CF708A.Letters Cyclic Shift

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given a non-empty string ss consisting of lowercase English letters. You have to pick exactly one non-empty substring of ss 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 ss by performing this shift exactly once?

输入格式

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

输出格式

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

输入输出样例

  • 输入#1

    codeforces
    

    输出#1

    bncdenqbdr
    
  • 输入#2

    abacaba
    

    输出#2

    aaacaba
    

说明/提示

String ss is lexicographically smaller than some other string tt of the same length if there exists some 1<=i<=s1<=i<=|s| , such that s1=t1,s2=t2,...,si1=ti1s_{1}=t_{1},s_{2}=t_{2},...,s_{i-1}=t_{i-1} , and s_{i}<t_{i} .

首页