import java.io.*; import java.util.StringTokenizer; public class Asona3{ public static void main(String argumendid[]) throws IOException{ BufferedReader klaviatuur=new BufferedReader( new InputStreamReader(System.in) ); System.out.println("Palun failinimi:"); String failinimi=klaviatuur.readLine(); System.out.println("Palun täht"); String taht=klaviatuur.readLine(); BufferedReader sisse=new BufferedReader( new FileReader(failinimi) ); String rida=sisse.readLine(); while(rida!=null){ StringTokenizer st=new StringTokenizer(rida, " "); while(st.hasMoreTokens()){ String sona=st.nextToken(); if(sona.startsWith(taht))System.out.println(sona); } rida=sisse.readLine(); } } }