C# program to count the frequency of the specified word in the given string
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
Program:
The source code to print the count of the word in the specified string in C# is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.
Output:
Explanation:
In the above program, we created a WordFrequency class that contains two static methods CountWordFrequency() and Main(). The CountWordFrequency() method returns the count of the specified word in the specified string. In the Main() method we created a string variable and took sentence as an input and then find the word occurrence and print on the console screen.