import java.io.*; import java.util.StringTokenizer; public class Ul1{ public static void main(String argumendid[]) throws IOException{ BufferedReader klaviatuur=new BufferedReader( new InputStreamReader(System.in)); System.out.println("Sisesta faili nimi"); String failinimi=klaviatuur.readLine(); System.out.println("Sisesta säna!"); String sona=klaviatuur.readLine(); BufferedReader sisse=new BufferedReader( new FileReader(failinimi)); String text=sisse.readLine(); int kokku=0; int loendaja=0; while(text!=null){ StringTokenizer punkt=new StringTokenizer(text,"."); while(punkt.hasMoreTokens()){ String lause=punkt.nextToken(); if(lause.toLowerCase().startsWith(" "+sona)){System.out.println(sona); loendaja++;} StringTokenizer tyhik=new StringTokenizer(lause," "); while(tyhik.hasMoreTokens()){ String sona2=tyhik.nextToken(); if(sona2.equals(sona))kokku++; } } text=sisse.readLine(); } System.out.println(loendaja+" "+kokku); System.out.println(loendaja*100/kokku); } }