首页 > 代码库 > Codeforces_AIM Tech Round 3 (Div. 1)_A

Codeforces_AIM Tech Round 3 (Div. 1)_A

http://codeforces.com/problemset/problem/708/A

 

贪心,先把前面连续的一串‘a‘排除,再向后知道找到第一个‘a‘,注意特殊情况。

 

#include<iostream>#include<cstdio>#include<string>using namespace std;int main(){    string s;    cin >> s;    int i;    for(i = 0;i < s.size() && s[i] == a;i++);    if(i == s.size())   s[i-1] = z;    else    {        for(;i < s.size() && s[i] != a;i++)   s[i] = s[i]-1;    }    cout << s << endl;    return 0;}

 

Codeforces_AIM Tech Round 3 (Div. 1)_A