Easy solution
Intuition\n Describe your first thoughts on how to solve this problem.  Take all leftmost \'a\'s after that change the further character till the next \'a\' com
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. --> Take all leftmost \'a\'s after that change the further character till the next \'a\' comes again..\n\n\n\n# Code\n```\nclass Solution {\npublic:\n    string smallestString(string s) {\n        int n = s.length() , i=0 ;\n        string ans = "";\n\n        // Taking all leftmost \'a\' as it is\n        while(i < n && s[i] == \'a\'){\n            if(i == n-1)  ans += "z";   // if it is last \'a\' change that to \'z\'\n            else ans += "a";\n            i++;\n        }  \n    \n        // Changing all other till next \'a\' comes\n        while(i < n && s[i] != \'a\'){\n            ans += s[i]-1;\n            i++;\n        }\n        \n        // Inserting all remaining characters\n        for(int j=i ; j<s.length() ; j++)  ans += s[j];\n        \n        return ans;\n    }\n};\n```
['C++']