import java.io.*; import java.util.StringTokenizer; public class OtsiS6na{ public static void main(String argumendid[]) throws IOException{ BufferedReader klaviatuur=new BufferedReader( new InputStreamReader(System.in) ); BufferedReader sisse=new BufferedReader( new FileReader("fail.txt") ); int lugeja=0; System.out.println("Sisesta otsitav sõna palun!"); String sisestus=klaviatuur.readLine(); String rida=sisse.readLine(); while(rida!=null){ StringTokenizer st=new StringTokenizer(rida, ",.?! "); while(st.hasMoreTokens()){ String s6na=st.nextToken(); if(s6na.equals(sisestus)) lugeja=lugeja+1; } rida=sisse.readLine(); } System.out.println("Seda sõna esines selles failis:"+lugeja+" korda"); } }