import java.io.*; import java.util.StringTokenizer; public class maija2 { public static void main( String args[] ) throws Exception { String margid = " .,!?;"; BufferedReader br2 = new BufferedReader( new InputStreamReader( System.in ) ); System.out.print("Palun failinimi: "); String strFailinimi = br2.readLine(); System.out.print("Palun sona: "); String strSona = br2.readLine(); StringBuffer Sonapikkus = new StringBuffer( strSona ); // BufferedReader fInput = new BufferedReader( new FileReader( strFailinimi ) ); // String strRida = fInput.readLine(); while ( strRida != null ) { // StringTokenizer token = new StringTokenizer( strRida, margid ); while ( token.hasMoreTokens() ) { String strNewSona = token.nextToken(); StringBuffer strNewSonapikkus = new StringBuffer( strNewSona ); // if ( strNewSonapikkus.length() == Sonapikkus.length() ) System.out.println( strNewSona ); } strRida = fInput.readLine(); } } }