CF708A.Letters Cyclic Shift
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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?
给你一个非空字符串 s,它仅由小写英文字母组成。你需要恰好选择 s 的一个非空子串,并将该子串中所有字母按如下规则进行移位:
'z'
'y'
'x'
'b'
'a'
'z'。
换言之,每个字符被替换为英文字母表中的前一个字符,而 'a' 被替换为 'z'。
通过恰好执行一次上述移位操作,你能从 s 得到的字典序最小的字符串是什么?
输入格式
The only line of the input contains the string s (1 ≤ |s| ≤ 100 000) consisting of lowercase English letters.
输入仅包含一行字符串 s(1 ≤ ∣s∣ ≤ 100000),由小写英文字母组成。
输出格式
Print the lexicographically minimum string that can be obtained from s by shifting letters of exactly one non-empty substring.
打印通过对字符串 s 中恰好一个非空子串的字母进行移位操作所能得到的字典序最小的字符串。
输入输出样例
输入#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 < t__i.
字符串 s 在字典序上小于另一个等长字符串 t,当且仅当存在某个 1 ≤ i ≤ ∣s∣,使得 s1 = t1,s2 = t2,…,si−1 = ti−1,且 si < ti。
输入解题思路,AI测评打分。不知道怎么写?