you give string s consist character 0 1 let s length sYou ask choose integer k k 0 find sequence length k 1 le a_1 a_2 dots a_k le s a_i1 1 a_i 2 k the character position a_1 a_2 dot a_k remove remain character concatenate change order so word position sequence adjacentlet result string s s call sorted 2 s s_i1 le s_idoe exist sequence result string s sort