Very Simple Solution!!!⚡⚡⚡
\n\n# Code\n\nclass Solution {\npublic:\n    string smallestString(string s) {\n        string ans;\n        int idx=s.size();\n        for(int i=0;i<s.size();i
\n\n# Code\n```\nclass Solution {\npublic:\n    string smallestString(string s) {\n        string ans;\n        int idx=s.size();\n        for(int i=0;i<s.size();i++){\n            if(s[i]==\'a\'){\n                idx=i;\n                break;\n            }\n        }\n        int q=idx;\n        while(s[q]==\'a\' && q<s.size()){//loop while you dont\'t get a character different from a\n            q++;\n        }\n        if(idx==0 && q<s.size()){\n            for(int i=q;i<s.size();i++){\n                if(s[i]==\'a\'){\n                    break;\n                }\n                else{\n                    s[i]-=1;\n                }\n            }\n        }\n        if(idx==0 && q==s.size()){\n            int n=s.size();\n            s[n-1]=\'z\';//if string contains only a then replace the last a with z\n        }\n        else if(idx!=0){\n            for(int i=0;i<idx;i++){\n                s[i]-=1;\n            }\n        }\n        return s;\n        \n    }\n};\n```
['C++']