Ch. 27, Writing Applications, Silver Challenge

I added:

  @Option(name: .short, help: "Maximum nubers of result")
  var count: Int = 0

and changed func findAndPrintMatches:

  private func findAndPrintMatches(for template: String,
                                   using wordFinder: WordFinder) {
    let matches = wordFinder.findMatches(for: template)
    
    print("Found \(count == 0 ? "\(matches.count)" : "\(count)") \(matches.count == 1 ? "match" : "matches"):")
    
    if count != 0 {
      for index in 1...count {
        print(matches[index])
      }
    } else {
      for match in matches {
        print(match)
      }
    }
  }