Lexicographically Smallest String After Substring Operation(Direct Solution)
Code
# Code
```java []
class Solution {
    public String smallestString(String s) {
       int n=s.length();
       int i=0;
       char ch[]=s.toCharArray();
       while(i<n && ch[i]=='a'){
        i++;
       }
       if(i==n){
        ch[n-1]='z';
       }
       while(i<n && ch[i]!='a'){
        --ch[i++];
       }
       return new String(ch);
    }
}
```
['Java']