Solved minimum substring problem