computer java program
Attachments:
Answers
Answered by
1
Answer:
import java.util.*;
public class Main
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.println("Enter Sentence: ");
String Sentence = in.nextLine();
System.out.println("Frequency of the word to be searched: ");
String search = in.nextLine();
String[] splittedSenctence = Sentence.split("\\s+");
int count=0;
for (int i=0;i< splittedSenctence.length ;i++ )
{
if(search.equals(splittedSenctence[i]))
{
count=count+1;
}
}
System.out.println(count);
}
}
Explanation:
Similar questions
Computer Science,
5 months ago
Math,
5 months ago
Hindi,
5 months ago
Math,
10 months ago
Social Sciences,
1 year ago
Social Sciences,
1 year ago