C++ | Beats 100 %
Code

# Code
```cpp []
class Solution {
public:
    bool compare(int i, int j, int start, int end, string &s)
    {
        if(start==-1)
           return true;
        if((j-i)!=(end-start))
           return  (j-i)<(end-start);

        while(i<=j)
        {
            if(s[i]!=s[start])
               return s[i]<s[start];
            i++;
            start++;   
        }   
        return true;
    }
    string shortestBeautifulSubstring(string s, int k) 
    {
        int count=0,i=0,j=0,n=s.size();
        int start=-1,end=-1;
        while(j<n)
        {
            count+=(s[j]-'0');
            while(count==k)
            {
                if(compare(i,j,start,end,s))
                {
                    start=i;
                    end=j;
                }
                count-=(s[i]-'0');
                i++;
            }
            j++;
        }
        return start==-1?"":s.substr(start,end-start+1);
    }
};
```
['C++']