C++|| Easy Solution || Brute Force
Complexity\n- Time complexity:\n O(n)\n\n- Space complexity:\nO(1)\n\n# Code\n\nclass Solution {\npublic:\n    string smallestString(string s) {\n        int in
# Complexity\n- Time complexity:\n O(n)\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution {\npublic:\n    string smallestString(string s) {\n        int ind=-1,n=s.length();\n        for(int i=0;i<n;i++)\n        {\n            if(s[i]!=\'a\')\n            {\n                ind=i;\n                break;\n            }\n        }\n        if(ind==-1)      \n        {\n            s[n-1]=\'z\';\n            return s;\n        }\n        for(int i=ind;i<n;i++)\n        {\n            if(s[i]!=\'a\')    s[i]--;\n            else             break;\n        }\n        return s;\n    }\n};\n```
['C++']