Scala, 120 bytes ================ readLine.inits.flatMap(_.tails).toList.groupBy(l=>l).filter(x=>x._2.length<2).map(_._1).groupBy(_.length).minBy(_._1)._2 I started off with 140 which at least already fits into a tweet. readLine input .inits.flatMap(_.tails).toList get all substrings of that string .groupBy(l=>l).filter(x=>x._2.length<2) remove substrings that occur more than once .map(_._1).groupBy(_.length) take the substring and group by length .minBy(_._1)._2 take the list of shortest substrings