Greedy
We greedily decrement leftmost continous substring of non-\'a\' characters (since \'a\' character would increase).\n\nBeware of an edge case when all characters
We greedily decrement leftmost continous substring of non-\'a\' characters (since \'a\' character would increase).\n\nBeware of an edge case when all characters equal \'a\'.\n\n**C++**\n```cpp\nstring smallestString(string s) {\n    auto i = s.find_first_not_of("a");\n    if (i == string::npos)\n        s.back() = \'z\';\n    else\n        for (; i < s.size() && s[i] != \'a\'; ++i)\n            --s[i];\n    return s;\n}\n```
['C']