For loop, sort, uniq, awk solution


  • 0
    T
    for i in `cat words.txt`
    do
        echo $i
    done | sort  | uniq -c | awk '{print $2" "$1}' | sort -k 2 -n -r

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.