Simple solution using Prefix sum with comments that beats 100% users
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    string shortestBeautifulSubstring(string s, int k) {\n        string shortestSubstring;  // Initialize the shortest substring to an empty string\n        int n = s.size();  // Get the length of the input string\n\n        // Iterate through the input string\n        for (int i = 0; i < n; i++) {\n            string currentSubstring;  // Initialize the current substring to an empty string\n            int j = i, countOnes = 0;  // Initialize j to i and countOnes to 0\n\n            // Continue looping while \'j\' is within the bounds and \'countOnes\' is less than \'k\'\n            while (j < n && countOnes < k) {\n                countOnes += s[j] == \'1\';  // Increase \'countOnes\' if the character is \'1\'\n                currentSubstring += s[j++];  // Add the character to the current substring\n            }\n\n            // If \'countOnes\' is equal to \'k\', it\'s a beautiful substring\n            if (countOnes == k) {\n                // If \'shortestSubstring\' is empty or the current substring is shorter, update \'shortestSubstring\'\n                if (shortestSubstring.empty() || currentSubstring.size() < shortestSubstring.size()) {\n                    shortestSubstring = currentSubstring;\n                }\n                // If the current substring has the same length as the current shortest, choose the lexicographically smaller one\n                else if (currentSubstring.size() == shortestSubstring.size()) {\n                    shortestSubstring = min(shortestSubstring, currentSubstring);\n                }\n            }\n        }\n        return shortestSubstring;\n    }\n};\n\n```
['String', 'Sliding Window', 'Prefix Sum', 'C++']