Create a program to count the frequency of words in a given string.
MediumProblem Statement
Create a program to count the frequency of words in a given string.
Sample Input
A hardcoded string: "this is a test this is only a test"
Sample Output
Word frequencies: {this=2, is=2, a=2, test=2, only=1}
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
fun main() {
val text = "this is a test this is only a test"
// Add your code here to count word frequencies
}
Input
A hardcoded string: "this is a test this is only a test"
Expected Output
Word frequencies: {this=2, is=2, a=2, test=2, only=1}