[ C++] O(n)
Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n\n# Co
# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    string smallestString(string s) \n    {\n        int i=0;\n        for(i=0;i<s.length();i++)\n            if(s[i]!=\'a\')break; \n\n        if(i==s.length()) \n            s[i-1]=\'z\';\n        for(;i<s.length();i++)\n        {\n            if(s[i]==\'a\')  break;\n            else s[i]-=1;\n        }\n        return s;\n    }\n};\n```
['C++']