Short and Sweet
Our strategy is to change characters to a left-to-right, while we can.\n\nWe first calculate how many operations we need to change it to a: \n- dist_a = min(s[i
Our strategy is to change characters to `a` left-to-right, while we can.\n\nWe first calculate how many operations we need to change it to `a`: \n- `dist_a = min(s[i] - \'a\', \'z\' - s[i] + 1)`.\n\nIf we have enough operations left (`dist_a <= k`), we change the character to `a`, and subtract `dist_a` from `k`.\n\nIf we cannot make `a`, we decrease the current character using the remaninig operations.\n\n> Note that we consider incrementing the current character only if we can cyclically reach `a`.\n> Otherwise, it only makes sense to decrease the current character.\n\n**C++**\n```cpp\nstring getSmallestString(string s, int k) {\n    for (int i = 0; i < s.size() && k > 0; ++i) {\n        int dist_a = min(s[i] - \'a\', \'z\' - s[i] + 1);\n        s[i] = dist_a <= k ? \'a\' : s[i] - k;\n        k -= dist_a;\n    }\n    return s;\n}\n```
['C']