Finalized getting input from stdin for wordcount in Swift