(""++io.Source.stdin split' 'sorted)sortBy(_.size)map println