easy understanding code for c++ !
\n# Code\n\nclass Solution {\npublic:\n    vector<int>pos;\n    string shortestBeautifulSubstring(string s, int k) {\n        for(int i = 0; i < s.size(); i++){
\n# Code\n```\nclass Solution {\npublic:\n    vector<int>pos;\n    string shortestBeautifulSubstring(string s, int k) {\n        for(int i = 0; i < s.size(); i++){\n            if(s[i]==\'1\'){\n                pos.push_back(i);\n            }\n        }\n        string min = "";\n        for (int i = 0; i < pos.size(); i++){\n            if (i+k-1 >= pos.size() or pos.size()<k){\n                break;\n            }\n\n            int len = pos[i+k-1] - pos[i] + 1;\n            string tmp = s.substr(pos[i], len);\n            if(i == 0){\n                min = tmp;\n            }\n\n            // find the smaller one\n            if( tmp.size() < min.size()){\n                min = tmp;\n            }\n            else if(tmp.size() == min.size()){\n                for(int digit = 0; digit < min.size(); digit++){\n                    if(tmp[digit] < min[digit]){\n                        min = tmp;\n                        break;\n                    }\n                    else if(tmp[digit] > min[digit]){\n                        break;\n                    }\n                }\n            }\n            \n        }\n        return min;\n    }\n};\n\n```
['C++']