( ) () { (.Args) == || .Args[] == || .Args[] == { .(.(.Args[])) .() } frequencyForWord := []{} _filename := (.Args[:]) { (filenamefrequencyForWord) } (frequencyForWord) wordsForFrequency := (frequencyForWord) (wordsForFrequency) } (files []) []{ .== { args := ([](files)) _name := files { matcheserr := .(name)err != { args = (argsname) } matches != { args = (argsmatches...) } } args } files } (filename frequencyForWord []) { file *.err fileerr = .(filename)err != { .(err) } file.() (.(file)frequencyForWord) } (reader *.frequencyForWord []) { { lineerr := reader.() _word := (.(line)) { (word) > .|| .(word) > { frequencyForWord[.(word)] += } } err != { err != .EOF { .(err) } } } } (s ) []{ notALetter := (char ) { !.(char) } .(snotALetter) } (intForString []) [][]{ stringsForInt := ([][](intForString)) keyvalue := intForString { stringsForInt[value] = (stringsForInt[value]key) } stringsForInt } (frequencyForWord []) { words := ([](frequencyForWord)) wordWidthfrequencyWidth := wordfrequency := frequencyForWord { words = (wordsword) width := .(word)width > wordWidth { wordWidth = width } width := (.(frequency))width > frequencyWidth { frequencyWidth = width } } .(words) gap := wordWidth + frequencyWidth - () - () .(gap) _word := words { .(wordWidthwordfrequencyWidthfrequencyForWord[word]) } } (wordsForFrequency [][]) { frequencies := ([](wordsForFrequency)) frequency := wordsForFrequency { frequencies = (frequenciesfrequency) } .(frequencies) width := (.(frequencies[(frequencies)-])) .() _frequency := frequencies { words := wordsForFrequency[frequency] .(words) .(widthfrequency.(words)) } }
有疑问加站长微信联系(非本文作者)
![](https://static.golangjob.cn/static/img/footer.png?imageView2/2/w/280)