{ "data": { "question": { "questionId": "192", "questionFrontendId": "192", "boundTopicId": null, "title": "Word Frequency", "titleSlug": "word-frequency", "content": "

Write a bash script to calculate the frequency of each word in a text file words.txt.

\n\n

For simplicity sake, you may assume:

\n\n\n\n

Example:

\n\n

Assume that words.txt has the following content:

\n\n
\nthe day is sunny the the\nthe sunny is is\n
\n\n

Your script should output the following, sorted by descending frequency:

\n\n
\nthe 4\nis 3\nsunny 2\nday 1\n
\n\n

Note:

\n\n\n", "translatedTitle": null, "translatedContent": null, "isPaidOnly": false, "difficulty": "Medium", "likes": 521, "dislikes": 303, "isLiked": null, "similarQuestions": "[{\"title\": \"Top K Frequent Elements\", \"titleSlug\": \"top-k-frequent-elements\", \"difficulty\": \"Medium\", \"translatedTitle\": null}]", "exampleTestcases": "a", "categoryTitle": "Shell", "contributors": [], "topicTags": [ { "name": "Shell", "slug": "shell", "translatedName": null, "__typename": "TopicTagNode" } ], "companyTagStats": null, "codeSnippets": [ { "lang": "Bash", "langSlug": "bash", "code": "# Read from the file words.txt and output the word frequency list to stdout.\n", "__typename": "CodeSnippetNode" } ], "stats": "{\"totalAccepted\": \"47.1K\", \"totalSubmission\": \"185.1K\", \"totalAcceptedRaw\": 47085, \"totalSubmissionRaw\": 185131, \"acRate\": \"25.4%\"}", "hints": [], "solution": null, "status": null, "sampleTestCase": "a", "metaData": "{\n \"shell\": true,\n \"manual\": true\n}", "judgerAvailable": true, "judgeType": "large", "mysqlSchemas": [], "enableRunCode": false, "enableTestMode": false, "enableDebugger": false, "envInfo": "{\"bash\": [\"Bash\", \"

Bash 4.3.30.

\"]}", "libraryUrl": null, "adminUrl": null, "challengeQuestion": null, "__typename": "QuestionNode" } } }