Program
import java.lang.*;import java.util.*;
class frequency
{
public static void main(String args[])
{
Scanner s=new Scanner(System.in);
System.out.println("Enter line of text ");
String str=s.nextLine();
StringTokenizer s1=new StringTokenizer(str," ");
int n= s1.countTokens();
System.out.println("Frequency count of given text is "+n);
}
}
Result
Enter line of textThis is the Java program for frequency count
Frequency count of given text is 8
No comments:
Post a Comment