Computer Science, asked by clarisumithra, 10 months ago

computer java program​

Attachments:

Answers

Answered by akshayamca14
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