Simple Solution, find the leftmost substring to apply operation. 100% beats
Intuition\nSince we need lexicographically smallest string, we need to make changes on the left most possible substring and after identifying this substring we 
# Intuition\nSince we need lexicographically smallest string, we need to make changes on the left most possible substring and after identifying this substring we will make changes accordingly.\n\n# Approach\nLets simply just find the first letter which is not equal to \'a\'\nafter that we just have to make changes till we don\'t find another \'a\' and that is our approach.\nif we dont find such element all we can do is apply the operation on the last element in the string whether its \'a\' or not.\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(1)\n\n# Code\n```\n#include <bits/stdc++.h>\nusing namespace std;\n#define nline \'\\n\'\n#define sp \' \'\n#define all(x) x.begin(), x.end()\n#define rall(x) x.rbegin(), x.rend()\nstatic int fastIO = []\n{\n    ios_base::sync_with_stdio(false);\n    cin.tie(0);\n    cout.tie(0);\n    return 0;\n}();\n// Paste the Class here-\nclass Solution\n{\npublic:\n    string smallestString(string s)\n    {\n        int other = -1;\n        int n = s.size();\n        for (int i = 0; i < s.size(); i++)\n        {\n            if (s[i] != \'a\')\n            {\n                other = i;\n                break;\n            }\n        }\n        cout<<other<<nline;\n        if (other == -1)\n        {\n            if (s[n - 1] == \'a\')\n                s[n - 1] = \'z\';\n            else\n                s[n - 1] -= 1;\n            return s;\n        }\n        else\n        {\n            int start = other;\n            while (s[start] != \'a\' && start<n)\n            {\n                s[start] -= 1;\n                start++;\n            }\n        }\n        return s;\n    }\n};\n```
['C++']