O(n) || Beats 100%
ApproachWE NEED TO CHANGE ALL THE CHAR BETWEEN 2 a's AND IF STRING CONSIST OF ONLY a THEN CONVERT THE LAST a ONLYComplexity
Time complexity:O(N)

Space complexi
# Approach
<!-- Describe your approach to solving the problem. -->
WE NEED TO CHANGE ALL THE CHAR BETWEEN 2 a's AND IF STRING CONSIST OF ONLY a THEN CONVERT THE LAST a ONLY

# Complexity
- Time complexity:O(N)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    string smallestString(string s){
        int st=0,l=0,n=s.length();
        while(st<n and s[st]=='a')st++;
        if(st==n){
            s[n-1]='z';
            return s;
        }

        l=st;
        while(l<n&&s[l]!='a'){
            int ch=s[l]-'a'-1;
            s[l]=ch+'a';
            l++;
        }
        return s;
    }
};
```
['C++']