Write a java program, which will read a text and count the occurrence of the word "the".For e.g.if the input is "The cat jumped over the fence". the output should be 2
bidisha496:
hey....
Answers
Answered by
0
Heymate!
Here's the answer.....
import java.io.*;
class the_counts
{
public static void main(String args [])throws IOException
{
InputStreamReader x=new InputStreamReader (System.in);
BufferedReader y=new BufferedReader(x);
int c=0;
String s="the",n,m;
System.out.print (Enter the sentence:);
n=y.readLine();
while (n!=0)
{
___________;
if (m==s)
c++;
}
System.out.print(c);
}
}
I hope it helps you....
Here's the answer.....
import java.io.*;
class the_counts
{
public static void main(String args [])throws IOException
{
InputStreamReader x=new InputStreamReader (System.in);
BufferedReader y=new BufferedReader(x);
int c=0;
String s="the",n,m;
System.out.print (Enter the sentence:);
n=y.readLine();
while (n!=0)
{
___________;
if (m==s)
c++;
}
System.out.print(c);
}
}
I hope it helps you....
Similar questions
English,
7 months ago
Computer Science,
7 months ago
Math,
1 year ago
English,
1 year ago
Social Sciences,
1 year ago