Skip to content

192. Word Frequency

https://leetcode.com/problems/word-frequency/

shell
# Read from the file words.txt and output the word frequency list to stdout.
cat words.txt | tr -s ' ' '\n' | sort | uniq -c | sort -rn | awk '{print $2, $1}'