Awful verbose java solution
Code\njava []\nclass Solution {\n    public String shortestBeautifulSubstring(String s, int k) {\n        //A substring of s is beautiful if the number of 1\'s 
# Code\n```java []\nclass Solution {\n    public String shortestBeautifulSubstring(String s, int k) {\n        //A substring of s is beautiful if the number of 1\'s in it is exactly k.\n        String shortest = s + "1";\n        ArrayList<String> shortestStrings = new ArrayList<>();\n        for(int i = 0; i < s.length(); i++){\n            if(s.charAt(i) == \'1\'){\n                if(k == 1){\n                    return "1";\n                }\n                int start = i;\n                int j = i+1;\n                int numOnes = 1;\n                while(j < s.length() && numOnes != k){\n                    if(s.charAt(j) == \'1\'){\n                        numOnes++;\n                    }\n                    j++;\n                }\n                if(s.substring(i,j).length() <= shortest.length() && numOnes == k){\n                    if(s.substring(i,j).length() == shortest.length()){\n                        //compare 2 equal strings:\n                        int l = 0;\n                        while(l < shortest.length()-1 && shortest.charAt(l) == s.substring(i,j).charAt(l)){\n                            l++;\n                        }\n                        shortest = shortest.charAt(l) < s.substring(i,j).charAt(l) ? shortest : s.substring(i,j);\n                    }\n                    else{\n                        shortest = s.substring(i,j);\n                    }\n                    shortestStrings.add(shortest);\n                    System.out.println(i + " " + j + " " + shortest);\n                }\n            }\n        }\n        if(shortest.equals(s + "1")){\n            return "";\n        }\n        else{\n            return shortest;\n        }\n    }\n}\n```
['Java']