C++ greedy
Code\ncpp []\nclass Solution {\npublic:\n    string getSmallestString(string s, int k) {\n        for(int i = 0;k && i<s.size();++i)\n        {\n            int
# Code\n```cpp []\nclass Solution {\npublic:\n    string getSmallestString(string s, int k) {\n        for(int i = 0;k && i<s.size();++i)\n        {\n            int dist = min(s[i]-\'a\',26-s[i]+\'a\');\n            if(dist>k)\n            {\n                s[i]-=k;\n                return s;\n            }\n            s[i]=\'a\';\n            k-=dist;\n        }\n        return s;\n    }\n};\n```
['C++']