Simple C++ Solution❤️
Complexity\n- Time complexity: O(n) , where n is length of string\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space compl
# Complexity\n- Time complexity: O(n) , where n is length of string\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 n=s.size(), i=0;\n       \n        while(i<n && s[i]==\'a\'){\n             i++;\n        }\n        if(i==n){\n            s[n-1]=\'z\';\n            return s;\n        }\n        while(i<n && s[i]!=\'a\'){\n            s[i]--;\n            i++;\n        }\n        \n        return s;\n    }\n};\n\n```
['C++']